Wednesday, August 29, 2007


I have a large drive containing both MP3s and my photographs. I have previously mounted the whole disk into the arbitrarily named /HDD-directory in /home. You need root privileges to mount:

sudo mount /dev/sda1 /home/adder1972/HDD

I decided I wanted to replace my HDD-directory with a /MP3 and a /Pictures directory.

I discovered the "mount --bind"-command, which according to the man-pages enables you to "Remount a subtree somewhere else (so that its contents are available in both places)."

So, I made my two new directories, and now I mount my large harddrive like this:

sudo mount --bind /media/sda1/Pictures /home/adder1972/Pictures
sudo mount --bind /media/sda1/MP3 /home/adder1972/MP3

Modifying /etc/fstab (*see note) would allow for automounting these directories. The way to do this is by adding:

/media/sda1/Pictures /home/
adder1972/Pictures none bind 0 0
/media/sda1/MP3 /home/adder1972/MP3 none bind 0 0

at the end of fstab. Since the "bind" command only re-mounts part of your drive, you cannot remove the original command to mount your drive, which is already in your fstab, i.e.:

/dev/sda1 /media/sda1 none 0 0

Run mount -a to have it take effect immediately.

* Note: Always remember to backup/copy the file you want to modify.
In order to edit fstab, type

sudo gedit /etc/fstab

at the command line (if you are using the "gedit" text editor).

No comments: