Mounting A Windows Share As A Raspberry Pi Directory At Boot Time

If you need to set up a permanent mount to a Windows share, you'll need to create an entry for it in your Pi's fstab. If you have not created a share on your Windows system, follow the steps here.

At the Pi command line, create a mount point in /mnt that will be connected to your PC:

sudo mkdir /mnt/name

Now edit your fstab:

sudo nano /etc/fstab

Insert a new entry in the following format:

//server/share /mnt/name cifs defaults,rw,username=username,password=password,domain=domain 0 0

Where server is the IP address or name of your PC, share is the name of the share that you created on your PC and name is the name of the mount point you have just created. username and password are a valid Windows username and password that must have been granted access to the Windows share. The domain keyword is used to specify the Windows domain or workgroup and not specifically the domain. While a manual mount at the command line will work without the domain keyword, this is required in the fstab.

Save the changes.

To refresh the mounts, issue the mount -av command:

sudo mount -av

I have also found that while a mount -av will mount the Windows share, this may not happen automatically at boot time - I need to investigate further!


Both CIFS and SMBFS seem to work when connecting to a Windows share. However, there are reports that CIFS should be used because if offers better performance and does not have the 2GB filesize limit of SMBFS. I tried copying a 10MByte file using both CIFS and SMBFS and the times were both about 2s.

Improved Security

It's poor practice to keep the username and password details in the fstab file and so, once the mount is confirmed as working satisfactorily, you should use the credentials keyword instead to point to a protected file that contains the username, password and domain. So change your fstab to look like this:

//server/share /mnt/name cifs defaults,rw,credentials=filename 0 0

and in filename put: