External harddisk Mini Howto for linux. (I am using ubuntu 7.10 and KDE)  :-)                                            Back to Main Page

This is a very short version, and if you want to know more, go to the Internet etc.

This howto is without any guarantee, and you may use it on your own responsibility only.

There may be errors, but I do not want to use too much time to  write this minihowto.

To check specific words or items you may try to Search in:  http://en.wikipedia.org/wiki/Main_Page/    or    http://www.google.com/




Index
       


In order to use an external usb harddisk

How harddisks are named in linux

The following package should be installed

When you get a new external harddisk

To make a directory by the name "yourdirectory"

To get proper writing permissions

To remove this directory

You should here note




In order to use an external usb harddisk it has to be partitioned and formatted (a usb flash stick can be formatted in the same way).

I will first show, how harddisks are named in linux language and shall here show the way my harddisks would be named.

The following package should be installed e.g. with synaptic: "usbmount".                                                                                Back to Index

It will automatically create usb0...usb7 mountpoints (directories) in the /media directory, and will also automatically mount any usb device you plug in (like an

external usb harddisk, usb memory stick, digital camera etc) in any of the mentioned usb0...usb7 mount points in numerical order) - it is important to keep track

of how you mount your mass storage devices, to keep the names the same.

My computer has two internal harddisks, "sda" and "sdb" and I will show the naming, when an external harddisk and and usb stick are connected at the same

time (see below)

The naming of 2 internal harddisks, an external harddisk and an usb stick

The naming is made automatically by the linux system and is as shown above:

A harddisk can be split up in parts, and each of these parts are named partitions in linux language.

A is the first internal harddisk (with 2 partitions) - "sda".                                                                                                                                Back to Index

"/dev/sda1" is the first partition and "/" is the name of its mountpoint - really a directory containing everything (this is where the whole linux system is placed

"/dev/sda2" is the second partition and "swap" is the name (swap is an intermediate place for storing of data) -  really a directory for data.

B is the second internal harddisk (with 1 partition) - "sdb".

/dev/sdb1 is the name of the only partition, and /media/sdb1 is the name of its mount point - really a directory where you can place data (directories and files).

C is an external usb harddisk - "sdc".

"/dev/sdc1 is the name of the only partition, and /media/usb0 is the name of its mount point - really a directory containing data.

D is a usb stick (with 2 partitions) - "sdd".

"/dev/sdd1" is the first partition, and /media/usb1 is the name of its moint point - really a directory.

"/dev/sdd2" is the second partition, and /media/usb2 is the name of its moint point - really a directory.

It is important for you to learn how the naming is done, so you should read this minihowto a couple of times with some days interval to let your brain adapt.

All these names are created automatically by the linux kernel, and if you change the way the usb connections are plugged in, the names will change, so it is

important to keep track of what you are doing, and if you want to use a specific set up, for example each time you make a backup, you must plug the usb

connection in the exact same way, each time, to keep the names.

I am using the same external harddisk for all my backups, and I keep it plugged in, and only switch the power on or off, each time I am using the harddisk.

If I am going to use another external harddisk, but the same setup files, I just have to exchange the plug, so it is sitting in the exact same way.

                                                                                                                                                                                                                                    Back to Index
The first thing to do, when you get a new external harddisk, is to partition it, and to format it, and I prefer to use the "gparted" program on the

"systemrescuecd" live cd:

1. Place the systemrescuecd in the cd slot, and start the computer.

2. At the "boot:" prompt press "enter".

3. At the "keymap" dialog insert e.g. "dk" for Danish (use the proper language of your keyboard) - "enter"

4. At the % prompt insert "su" - "enter" (the "%" changes into an "#" - and you become super user)

5. Insert "startx" - "enter" and you get into a graphics desktop - double click on the konsole icon - to open a konsole.

6. Write "gparted" - "enter" and the gparted partitioning program opens.

7. Plug in the usb plug of the external harddisk, switch on the power, wait a moment and the external harddisk will automatically by detected by the linux kernel.

8. Click in the upper right corner of the "gparted" dialog, and select the device of the external harddisk.

9. If you have only one internal harddisk the device name of the external harddisk will be "/dev/sdb" (see below "F")

One internal harddisk plus one external harddisk

10. Then follow the instructions according to the Gparted_howto - that is create the number of partitions you like (I prefer only one partition on the whole

harddisk) - format it as a primary partition and use the "ext3" format - "Apply".                                                                                                Back to Index

11. When finished close the gparted program "GParted - Quit" and switch of the power of the external harddisk.

12. Right click on the desktop and choose "Exit".

13. At the "#" prompt insert "shutdown - h now" - "enter" - and the computer will shut down (remove the cd).


Switch on the computer and log in again.

Switch on the external harddisk, and it should be automatically mounted on "/media/usb0" (this assumes that only one usb device is connected and switched on -

namely the external harddisk).

Normally when you make bakcups, it is best to do the backup as "sudo", as it is then not so easy to delete the backup by mistake.

However, in order to make a directory by the name e.g. "yourdirectory", which can be used as an ordinary user, open a konsole and insert following:

"sudo mkdir /media/usb0/yourdirectory" - "enter" (creates the directory "yourdirectory" in the "/media/usb0" directory.

Let's suppos your user name is "joe"

"sudo chown -R joe:joe /media/usb0/yourdirectory" (changes the ownership of the "yourdirectory" to the user "joe", so he can use it as an ordinary user).

To get proper writing permissions, which normally already is set, you could insert:

"sudo chmod -R 755 /media/usb0/yourdirectory" 

If you later would remove this directory you should insert:

"sudo rm -R /media/usb0/yourdirectory" (removes the "yourdirectory" including all subdirectories -and files)                                                Back to Index

You should here note, that the contents of the external harddisk is "permanent" (until you edit it), but the mount point could be different, if you plugged the

external harddisk in a different way, or on another computer.

You should also note, that the procedure described above would be the same for a usb flash memory stick.


12/2007