I’ve had a couple of friends ask me how to do this, so I thought a little guide would be handy, so please read on as we go through how to format external storage to ext3 and automounting in linux – all commands are in bold, please use your own /dev/* device that gets listed in place of mine.

1.– first, take note of the current mounts on your system using the following command:

blkid –o list

2.– insert your external storage via usb or firewire and re-run the command to confirm the correct device to format:

blkid –o list

3.– now we have confirmed the device to format, lets check it out with the parted command:

parted /dev/sdg (/dev/<your device>)

print

4.– ok, we can see the two partitions – we’re going to reformat the 2nd partition – lets look at this one a bit closer.  First type ‘quit’ to exit out and then:

parted /dev/<your device> (and then print at the prompt)

5.– Now we know the device, lets format it – be very careful to enter the correct device here, as you could blow your system or current storage!

First type quit to exit out of parted, and then type

mkfs –t ext3 /dev/<your device>

This will erase all data on the partition, and format it to ext3.

6.– lets check it out again using

blkid –o list

we can see /dev/sdg2 has now been formatted to ext3, but it has no label.

7.– lets give it a label with the following command

e2label /dev//<your device> MyExt3Partition

and then run blkid –o list again:

also, take note of the UUID field, we’ll be using this to help the device automount at boot..

8.– lets create an fstab entry for this device, using the UUID from above.

vi /etc/fstab – this will open the fstab file in an editor

hit i to go into insert mode – note the mode at the bottom of the image

Use the arrow keys to go down to the bottom of the file and create a new line for your device.  Use the <tab> key between fields, and choose an appropriate mount point – you will need to create this directory in a second.

9.– write out the file and exit by hitting the ‘esc’ key and entering the following command, followed by the ‘enter’ key

:wq!

10. – now lets create that mount point, and apply rw permissions – the /mnt or /media directories are good to use.

Check you aren’t about to overwrite a current directory

ls –la /mnt/

And make the directory using

mkdir /mnt/MyExt3Partition

The directory has been made, but only the owner can write – lets open that up using chmod, and checking again

chmod –R 777 /mnt/MyExt3Partition

11.– cool, everything is looking good – lets mount it

mount /mnt/MyExt3Partition

and check it has the space

df

12. – awesome, we have now set up this device to always mount at startup!