Linux USB

Document Sample
Linux USB Powered By Docstoc
After purchasing your external hard drive you need to plug it in to your server. If you have some
sort of desktop installed like GNOME or KDE, they will typically detect your external drive and it
will popup automatically on your desktop. However, this won’t happen from the command line,
and you may have the auto-mount option turned off.
Finding Your External Hard Drive
Linux gives all external devices a name in the /dev folder and it can be tricky to determine
exactly which device your external drive will mount to, however /dev/sda1 is pretty common for
external hard drives. If you are unsure, simply type df into your terminal, it will list the amount of
disk space available on your server and where it is located. It will list /dev/hda1, /dev/hda2 (if
you have a second hard drive), and in our case, it also listed /dev/sda1 which was our external
hard drive.
Mounting the External File System (Hard Drive)
To mount your hard drive you need to use the mount command. (To unmount the drive when
you are ready to unplug it and take it home, use the umount command.) Here’s an example:

 mkdir /mnt/usbdrive
 mount /dev/sda1 /mnt/usbdrive

The above command first creates a directory in your /mnt folder, typically the folder will be
descriptive of the device, so we use /mnt/usbdrive. This only has to be done once, as you won’t
be deleting this folder. This folder will be your mount point for the external hard drive.
The second line mounts the device at the /dev/sda1 location to the /mnt/usbdrive directory.
Now you can reference your hard drive from the command line using the folder /mnt/usbdrive.
Automount In the Terminal
To have your hard drive mount each time your server is restarted, you must edit your /etc/fstab
file. Simply add at the bottom of your /etc/fstab file:
/dev/sda1    /mnt/usbdrive     ext3    defaults 0 0
The first argument (/dev/sda1) tells the system what device to mount, and the second argument
(/mnt/usbdrive) tells the system where to mount it. The third argument is the filesystem type
(ext3). The fourth argument (defaults) tells the system what options to apply to the device, so in
this case we’ll just use the defaults. The fifth and sixth arguments (both zeros) tell the system if
the filesystem should be backed up using the dump utility, and the second zero tells the system
whether to process the device when fsck is run. We can leave them both to zero for now.
Now you have a mounted hard drive that you can use for all your company backups, and by
reading our previous two articles you can setup a script to automate your backup.

Shared By: