Ubuntu Server 7.04 Fiesty: Mounting or Accessing a USB Drive in Bash Shell

I ran into a problem today accessing a USB Drive in Ubuntu Server. In Windows and in Ubuntu Standard, plug and play works fine. My laptop, which has Ubuntu installed, immediately recognized the USB drive once it was plugged in. I accessed its contents in the Bash shell by typing:

ls -l /media
ls -l /media/ExternalHDD

Typing the same thing in Ubuntu Server will not yield the same results. Ubuntu 7.04 server does not come with automatic mounting. After plugging in your drive, you need to run a few commands before access to the drive will be allowed. The first command is to install a program called ‘pmount’. Type:

sudo apt-get install pmount

After installing the pmount, you need to figure out what the drive is called on your system. Type:

fdisk -l

You should see output that looks like this:

Disk /dev/sdf: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdf4 * 1 36481 293033601 7 HPFS/NTFS

The USB drive I am using is called ‘/dev/sdf4’. To mount the drive, you’re need to create a directory to alias the drive and use pmount to reference the alias. To do this I type:

sudo mkdir /media/usbdrive
pmount /dev/sdf4 /media/usbdrive

Afterwards, I copied a bunch of files on the USB drive and set the ownership of the files from root to myself. I typed:

sudo cp -R /media/usbdrive/filesToCopy /home/alex/
cd /home/alex
sudo chown -R alex:alex filesToCopy

New Article

Leave a Reply