Mounting a USB Hard Drive automatically with fstab


Recommended Posts

I can mount a USB Hard Drive (sda) just fine with the terminal, however, I need it to mount on bootup. The mount point I desire is /mnt/USBHD (which I already made). I think that one must use fstab to do this. What do I need to add to fstab?

Link to comment
Share on other sites

I figured out how to do it. Being that I am in the spirit of this community, I will write information on mounting the USB hard drive. This is an example of setting up a unpartitioned USB HD in mandrake.

First, all mounting and editing of fstab should be done with the root account, or you will not get far. Before adding the drive to fstab, you should first see if you can mount it at all.

To mount:

The drive is most likely sda or sdb or something like that, but to make sure, go to the mandrake control center, click on mount points, then click on "diskdrake helps you..." with that picture of a hard drive. This will show you all your hard drives. The hard drives inside your computer are hda, hdb and so on. The USB hard drive will be listed as sda, or sdb...something like that. It is important to remember the "sda" part and to notice if there is anything wrong with the disk from Mandrake before proceeding.

Now we get the joy of mounting it.

Open up the terminal. For KDE, that is Konsole. It should be somewhere... Once the black screen is opened up, type in "mkdir /mnt/USBHD"(no quotes) and press enter. That will make the USBHD folder in the /mnt directory. This will be used as a mount point. By opening up this directory, you view the contents of the drive. The mount point doesn't have to be USBHD, it can be named almost whatever you wish, wherever you wish, but for the purpose of simplicity, I suggest you make it /mnt/USBHD.

The next step is to mount the thing. In the same black screen, type in "mount -t vfat /dev/sda /mnt/USBHD"(no quotes). This command may be different depending on what mount point you made and if it is sda or sda1 or sdb or whatever. The "-t vfat" part means that the drive is FAT file system. If your drive is different, like if your drive is NFTS, then vfat needs to be changed to something else. If you get no errors, the drive has been mounted and you can use it! Yay. Go to the directory /mnt/USBHD and all your stuff will be there! YAY! Drive mounted!

...but...

it will not be mounted when you reboot your system, nor is having it in /mnt/USBHD make it a easily accessable place. Now we must use fstab and some other tricks to get things right. The thing is about USB Hard Drives, if we have it set to mount on startup (using the power of fstab) and then have it off one day, then system will not boot, or at the very least complain. What we can do is make it so with the double click of an icon, the drive is mounted and the contents are loaded in a mear second. To do this, we must first edit fstab:

In the terminal, type in "emacs /etc/fstab"(no quotes). This will bring up the entries of fstab. On the bottom, type in this:

/dev/sda /mnt/USBHD vfat user,exec,noauto,codepage=850,iocharset=iso8859-1,quiet,umask=0 0 0

Change /dev/sda, /mnt/USBHD and vfat if needed. Now save it. Now close all terminal screens, logout as root and login as a normal user. Right click the desktop, go to create new and select hard disk. In the general tab, change the name to whatever you want, then go to the device tab. For device, click the arrow and select "/dev/sda (/mnt/USBHD)". Again, it might be different if you have a different mount point or sda drive, so take it into account. Press the OK button and double click the icon. WHALA! Your drive is now easy to access!

One more note: Partition Magic is a piece of trash.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.