An array of C#, PHP, and HTML programming articles, tutorials, and resources

Posts Tagged ‘ drive ’

To mount a USB External Hard Drive to a Linux Box, first make sure the unit is plugged in and powered on. Depending on your linux distribution, the hard drive may automatically mount. If this is not the case, mounting the external hard drive is not a very complicated tasks.

To begin, you will need to know where the hard drive is located. In most cases, the location is /dev/sda1 (though this is not always the case). However, if this isn’t the case, you can run the df command into you console. This will return a list of devices where you will most likely be able to find your drive by means of the hard drive max capacity.

Now, assuming the external hard drive is found at /dev/sda1. A great default place to mount the drive is in the /mnt/usbdrive. You will first need to make sure the folder already exists. If the folder does not exist, it can be created by using the command mkdir ‘/mnt/usbdrive‘. Then, use the below command into your terminal:

mount /dev/sda1 /mnt/usbdrive ext3 default 0 0

In the above example, mount is the command, /dev/sda1 is where the hard drive is currently located and /mnt/usbdrive is the folder in which you want the mount the hard drive. The next ext3 is the hard drive file system (Click here for information on Linux File Systems). The next input ‘default’ tells the default settings to be used. The first zero means to back up the file system using the dump utility and the second zero tells the OS whether to process the hard drive if fsck is run.

To have the Linux distribution automatically mount the drive on boot, you will need to add an entry (line) to the /etc/fstab file. In this case, it will be exactly the same as the mount command, except you will not need the mount command:

/dev/sda1 /mnt/usbdrive ext3 default 0 0

Now you have your external that is mounted when the Linux operating system boots up.