Most Linux distribution such as Ubuntu automatically mounts your usb drive when it is plugged in. Sometimes we take this for granted and if for some reason the drive doesn’t load we tend to pull our hair out trying to figure out why. If you’re like me then this is a sad reality that you have to overcome perhaps every week.
The other day I was locked out of my Ubuntu after upgrading from Intrepid to Jaunty and GDM decided to take a break. The real problem occurred when I urgently needed my CV to be sent off that day and the most up-to-date CV was on my Ubuntu login, sigh.
What I did
After launching the recovery mode from GRUB I was able to get to a root console. This was good because my girlfriend had her laptop so I could send the CV from her Windows XP system (don’t laugh).
Anyway, here goes… but remember before accessing root you should consider backing up your important files so any mishap wont have you eating your heart out.
Please be careful when running commands under Linux as root, if you are unsure then ask someone before making any changes as root.
Detecting USB hard drive
After you plug in your USB device to your USB port, linux add new device into /dev/ folder. At this stage you are not able to use this device. You need to mount it to your system first in order to be able retrieve any data. To find out what name your device have you can run fdisk command:
# fdisk -l
You will get output similar to this:
Disk /dev/sda: 60.0 GB, 60060155904 bytes 255 heads, 63 sectors/track, 7301 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 7301 58645251 83 Linux
Creating the mount point
Create directory where you want to mount your device:
To automate this process you can edit /etc/fstab file and add line similar to this:
/dev/sda1 /mnt/sda vfat defaults 0 0
Run mount command to mount all not yet mounted devices. Keep in mind that if you have more different USB devices in you system, device name can vary!!!
# mount -a
Original article: http://www.linuxconfig.org/Howto_mount_USB_drive_in_Linux