All | 43 Folders | Accessibility | BoingBoing | Books | Computer Related | Family | Films | General | Hacking | Hobbies | Humor | Java | Links | Omni | OpenSolaris | Puzzles and Games

« Howtoons | Main | VectorMagic »
20071026 Friday October 26, 2007

Group Ownership Problems With Files On External Disk

I'll throw this problem out there, in the hope that somebody can suggest what's going wrong here. The various experts have been a great help to me with previous similar questions. This is on Ubuntu Gutsy.

I have an 80GB Mercury disk externally connected to my Ferrari laptop via a USB cable. It's automatically mounted at startup time and Nautilus sees it just fine.

I use it for backups. My backup command is:

/usr/bin/rsync -a -v --delete --timeout=600 /home/richb /media/UNTITLED_/BACKUPS/UBUNTU'

This nicely writes out the files from my home directory to the external disk, but I get lots of output from rsync with lines like:

...
rsync: chgrp "/media/UNTITLED_/BACKUPS/UBUNTU/richb/DVD/documents/.365DAYS.PDF.kRd33A" failed: Operation not permitted (1)
...

If I look at that file with:

  % cd /media/UNTITLED_/BACKUPS/UBUNTU/richb/DVD/documents/
  % ls -l 365DAYS.PDF
136665 14272 -rwx------  1 richb root 14587230 2007-03-18 14:01 365DAYS.PDF

I can see that the group ownership is "root", but if I do the following in a terminal window:

  % cd /media/UNTITLED_/BACKUPS/UBUNTU/richb/DVD/documents/
  % sudo chgrp richb 365DAYS.PDF

I get:

[sudo] password for richb:
chgrp: changing group of `365DAYS.PDF': Operation not permitted

What am I missing?

My other question, is why isn't this disk mounted at /media/UNTITLED? That's just am empty directory. (Maybe this is related).

Here's the information from mount:

$ mount
/dev/hda3 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)
/dev/hda1 on /media/hda1 type vfat (rw,utf8,umask=007,gid=46)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/dev/sda1 on /media/UNTITLED_ type vfat (rw,nosuid,nodev,shortname=mixed,uid=1000,utf8,umask=077,usefree)

Any pointers into what I'm doing wrong would be very much appreciated. Even though the backups apparently are working just fine, I'd like to fixup the group ownership problem.

[]

[]

( Oct 26 2007, 02:21:24 PM PDT ) [Listen] Permalink Comments [13]

Comments:

Hey,
The answer is contained in the 4th column of the last line in the output of your mount command....
Your problem is the filesystem being used on the external disk, vFAT aka FAT32. It does not support filesystem attributes like group/owner and unix file permissions. If you are using the drive with Linux systems only, repartition it and reformat it to ext3.

David

Posted by David Yaffe on October 26, 2007 at 02:49 PM PDT #

Hi,

is the backup disk automatically mounted or do you have a way to specify additional parameters for the mount? vfat does not support user and group ids, but you can set default uid and gid while mounting vfat volumes. Ubuntu (or you) seems to only set the uid. Adding 'gid=1000' or whatever group id your files belong to should fix the problem.

A better fix might be to reformat the disk to use a better filesystem, for example ext2 or ext3. vfat does not support certain filenames which are supported by ext2/3; if you only use the disk as a backup media and not to exchange files with windows or OS X computers, you will be better of with a sane file system.

Posted by Matthias on October 26, 2007 at 02:52 PM PDT #

The problem might be related to the fact that VFAT does not actually know anything about groups? Vfat stores files and they get the permissions and owners just by the options given to the mount command. I don't have a vfat drive here atm, but I guess that that might be problematic.

@UNTITLED_:
What's the disk's label? Did it get a suffixed "_" by accident somehow?

Posted by tante on October 26, 2007 at 02:52 PM PDT #

Thanks all.

It's a VFAT file system as I use it to back up all
three of the operating systems that are on this
machine (Ubuntu, Solaris and Windows Xp),
depending upon which one I'm currently running.

> is the backup disk automatically mounted or do
> you have a way to specify additional parameters
> for the mount?

I don't do anything special to mount this disk.
How can I determine how/when/where it was
mounted?

> Adding 'gid=1000' or whatever group id your
> files belong to should fix the problem.

Okay, but where? :-)

> What's the disk's label?

How can I tell?

Posted by Rich Burridge on October 26, 2007 at 03:12 PM PDT #

Re: disk label.

> How can I tell?

To partially answer my own question, looks like:

https://help.ubuntu.com/community/RenameUSBDrive

is the way to go. I've been unable to get mlabel to
give me anything but the usage message:

richb@richb-laptop:~$ sudo mlabel /dev/sda1
Mtools version 3.9.10, dated March 2nd, 2005
Usage: mlabel [-vscVn] [-N serial] drive:

$ sudo mlabel /dev/sda1:
Mtools version 3.9.10, dated March 2nd, 2005
Usage: mlabel [-vscVn] [-N serial] drive:

$ sudo mlabel -s /dev/sda1:
Mtools version 3.9.10, dated March 2nd, 2005
Usage: mlabel [-vscVn] [-N serial] drive:

Posted by Rich Burridge on October 26, 2007 at 03:23 PM PDT #

Okay, so here's the answer to "what's your
disk label?":

I found:

http://ubuntu.wordpress.com/2006/03/01/editing-fat32-partition-labels-using-mtools/

My ~/.mtoolsrc file looks like:

# Debian default mtools.conf file.
# "info mtools" or "man mtools.conf" for more detail.

# # Linux floppy drives
drive a: file="/dev/fd0" exclusive
drive b: file="/dev/fd1" exclusive

# # First SCSI hard disk partition
drive c: file="/dev/sda1"

# # dosemu hdimage.
drive m: file="/var/lib/dosemu/hdimage.first" partition=1 offset=128

# # dosemu floppy image
drive n: file="/var/lib/dosemu/fdimage"

mtools_skip_check=1

I then ran:

% sudo mlabel -s c:
Volume label is UNTITLED

Posted by Rich Burridge on October 26, 2007 at 03:29 PM PDT #

There is a "quiet" option you can put in the fstab for mounting fat volumes.

Posted by Pete on October 26, 2007 at 03:35 PM PDT #

For backups to drives/shares that don't support all features there's rdiff-backup. It works similar to rsync but it has some nice additional functionality, like storing all attributes even in SMB or vfat. Also, it keeps track of revisions and only stores binary deltas, so that your backup doesn't inflate too fast.

Posted by Tobias on October 26, 2007 at 03:36 PM PDT #

Oh, and the dash in the end could be due to the automounter avoiding existing mount points. It will create a fresh mount point derived from the label, but if that exists already it appends an underscore.

Posted by Tobias on October 26, 2007 at 03:38 PM PDT #

Thanks everyone.

I've added an entry to /etc/fstab

/dev/sda1 /media/UNTITLED vfat uid=1000,gid=1000,auto,rw,user 0 0

This mounts it at startup time onto /media/UNTITLED

I changed by rsync command to:

alias USB_BACKUP='/usr/bin/rsync -a -v --delete --timeout=600 /home/richb /media/UNTITLED/backups/ubuntu'

I've noticed that now some of the filenames have
lowercase names, so I suspect I'm still not doing
this exactly right.

The first rsync run deleted everything on the
external disk under /media/UNTITLED/backups/ubuntu
but it seems to be writing them out nicely now.

Posted by Rich Burridge on October 26, 2007 at 03:52 PM PDT #

Oh, I'll also checkout rdiff-backup.
Thanks Tobias.

Posted by Rich Burridge on October 26, 2007 at 03:55 PM PDT #

Why do you use VFAT ? It's crap.. You'll have problems with lower/uppercase.. Problems with ownerships... VFAT is only ok for windows :)

Posted by locked on October 26, 2007 at 04:32 PM PDT #

If you need ownership control then use ext2/ext3.
There is a windows driver for ext2:
http://www.fs-driver.org/

Posted by uhuu on October 26, 2007 at 08:05 PM PDT #

Post a Comment:

Comments are closed for this entry.