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: -


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.

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...