How to Mount Network Drive on Headless Pi

Though Raspberry Pi has added many handholding tools since, there are few quirks users from traditional operating system could not get accustomed to. Heck, I hail from different flavors of Linux, even I find headless Pi to be too barebones at time. I felt that the hardest when the earlier version of headless Pi would not mount USB drives automatically to /mnt/ point — I had to create a path for the mount command.

Same rule applies to network mount. Only this time, we need to specify few more things: how it will connect, where it will connect, with what credentials.

  1. Create a mounting path of your choice using following command, where [somename] will be the name of the folder.

sudo mkdir -p /mnt/[somename]

  1. Run the following command to mount the drive over SMB. [username], [sharedfolder] and [ip] are of the remote location, not the local.

sudo mount -t cifs -o username=[username] //[ip]/[sharedfolder] /mnt/[somename]

For example this is what I did:

sudo mount -t cifs -o username=[MyNASUsername] //[NAS]/[BackupVolume] /mnt/[NetworkBackup]

From there on, it’s business as usual. The contents of the shared folder will show up under /mnt/ via the path of your choice.

Leave a comment

Comments will be automatically closed after 30 days.