Code:
Linux2 box has the following fstab:
/dev/sdb1 /media/usb vfat auto,rw,users,uid=0,umask=000 0 0
For a removable drive, don't use the "noauto" option instead. You don't want booting to fail because the device isn't plugged in.
Also, use "UUID=<UUID#>" instead of the device. The next time it is plugged in, it could have a different device node assigned.
You can use "udevinfo -q env -n /dev/sdb1" to discover the UUID number of the device.
You could instead, while the device is mounted, list the /dev/disk/by-uuid/ directory and see which link points to /dev/sdb1.
ex:
Code:
ls /dev/disk/by-uuid/ -l
total 0
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 145266D35266B95E -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 14D23645D2362AFE -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 21a3c26d-0927-494a-b429-e7c613237525 -> ../../sda7
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 61b27e9c-572d-4706-9d03-1fb49fefd53b -> ../../sdb1
Different filesystems use different sized uuid serial numbers. For a vfat drive, it will be shorter. In my example, I would use:
UUID=61b27e9c-572d-4706-9d03-1fb49fefd53b
in the first column of the fstab entry.
Fat32 & NTSC filesystems aren't Linux native, so you can't use chmod or chown to change the permissions. That is the reason for the error message you are seeing. If you are using Samba to share an ext3 filesytem, then using cifs instead of the obsolete smbfs will allow permissions to be retained. You can even use setfacl & getfacl.
If the permissions are important, and you are backing up files to a Fat32 or NTSC filesystem, it would be better to create a tar archive. The permissions and ownership will be contained inside the archive. The -G <timestampfile> option allows you to easily create incremental backups.
A tar archive will preserve ownership, permissions, and attributes. My version won't preserve ACLs however.
There are some options you could try mounting cifs, vfat or NTFS. "uid=", "gid=", "fmask=", "dmask=" determine the permissions of the mounted filesystem. They are changed en-mass. You can have different permissions for directories than files however. When saving files to a mass storage device, it is a good idea to have the 'x' bit clear. You need the 'x' bit set for directories however.
If you use both the "user" and "uid" options, the filesystem can be mounted giving you exclusive access, using the correct "fmask" & "dmask" values. Not only that, but you can mount it manually as a normal user. You don't need to su to root. So on your system at least, a pendrive with a UUID number can only be mounted with ownership and permissions that you determined. It could be mounted normally on another computer of course.