Wednesday, 8 July 2009

Mounting the mounting mountain

Couldn't work out why we were unable to mount an EXT3 partition as a non-root user on Ubuntu *AND* write to it.

It turned out that, although /etc/fstab was OK, with the following line: -

/dev/sdb1 /media/mynewdrive ext3 defaults 0 0

and the non-root user had permission to write to the top-level mount point ( /media ) and the subdirectory ( /media/mynewdrive ), the same permissions did not extend to the file system on the drive.

The solution was to: -

a) Mount the drive as root ( sudo mount -a )
b) Change the permissions for the filesystem e.g. chmod -R 777 /media/mynewdrive

This sets the RWX permissions for the entire file system AND the mountpoints.

We were then able to unmount the drive ( sudo umount /media/mynewdrive ) and then remount it ( sudo mount -a ) and write to a file ( touch /media/mynewdrive/foobar ).

As the final acid test, we rebooted to ensure that the drive automatically mounted - according to: -

http://www.tuxfiles.org/linuxhelp/fstab.html

the defaults value in /etc/fstab are: -

rw
suid
dev
exec
auto
nouser
async

As with all things, DON'T DO THIS IF YOU ARE NOT SURE WHAT YOU'RE DOING or YOU'RE NOT SURE WHAT THE IMPACT WOULD BE or IT IS NOT YOUR DRIVE.


Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]