Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Trouble Writing to Pi NAS

Thu Sep 06, 2012 9:05 pm

I am trying to set up my Pi as a home NAS device but while I can connect to it & read the contents from my other linux/windows PCs I cant write files to it. I have followed the instructions at http://elinux.org/R-Pi_NAS for creating a public storage area exactly, using /media/nas as the path I have mounted my usb storage device to. I can access & read files on the device but not write to it. Even though the initial steps involve changing the owner & permissions ( I actually used 'chmod -R ugo=rwx'), once mounted, if I 'ls -l /media' I get:

Code: Select all

drwxr-xr-x 4 root root 4.0k Jan 1 1970 nas
If I unmount the device though (sudo umount/nas) & then 'ls -l /media', I get:

Code: Select all

drwxrwxrwx 2 root users 4.0k Sep 6 20.47 nas
(the 'nas' is shaded in green also)

Everything goes OK when I restart samba. Can anyone please tell me where I am going wrong

jamesbooker
Posts: 1
Joined: Fri Sep 07, 2012 5:26 am

Re: Trouble Writing to Pi NAS

Fri Sep 07, 2012 5:28 am

What type of filesystem are you mounting?

Please post the result of doing:

Code: Select all

cat /etc/fstab

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Trouble Writing to Pi NAS

Fri Sep 07, 2012 8:08 am

This is probably not a Samba problem.

It is very common for people to forget to set an owner when mounting a USB drive. Did you mount using the mount command or did you use the /etc/fstab file? A drive without an owner will be read-only.

I assume that you are trying to mount a Windows drive. If you wish to mount a Windows drive, you must use the options uid and gid in the /etc/fstab file to give a user ownership of the drive. For example uid=pi,gid=pi will give the user pi ownership of the USB drive.

For examples for all the common drive formats, look up fstab in Wikipedia.

Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Re: Trouble Writing to Pi NAS

Fri Sep 07, 2012 7:38 pm

I set up my /etc/fstab according to http://www.simonthepiman.com/how_to_set ... server.php. I am testing my Samba setup with a 2Gb fat formatted USB stick to start with but once I can get it working I will be hooking up my 500Gb NTFS formatted external HDD. cat /etc/fstab gives me:

Code: Select all

proc   /proc   proc   defaults   0   0
/dev/mmcblk0p1   /boot   vfat   defaults   0   0
/dev/mmcblk0p2   /   ext4   defaults,noatime   0   0
# a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that
/dev/sda1   /media/nas   vfat   defaults   0   0
When I hook up the NTFS formatted drive I was going to change the last line to:
/dev/sda1 /media/nas ntfs-3g defaults 0 0 (with appropriate /dev/sda#)
What command should be in /etc/fstab for this setup?

Altin
Posts: 21
Joined: Fri Aug 24, 2012 10:52 pm

Re: Trouble Writing to Pi NAS

Sat Sep 08, 2012 8:42 pm

OK I got it to work, I just want to check if it is setup correctly. From the wikipedia entry on fstab, I changed the entry in my /etc/fstab to:

Code: Select all

/dev/sda1 /media/nas vfat umask=000 0 0
I now have Read Write access to the drive. Yey :D ! But I dont really understand what the setting means/does so Im wondering if this is the 'correct' way to do it. When I hook up my NTFS drive will it be sufficient to simply change the entry to:

Code: Select all

 /dev/sda1 /media/nas ntfs-3g umask=000 0 0 

Return to “Troubleshooting”