Thursday, April 2, 2009

Linux: How to use an external hard disk, how to mount it

Problem: In my case I plugged the external hard disk into the USB port; a new folder with the name of my external HD was created, but it was empty.

Solution: I had to mount by hand the external hard disk, even if it was automaticaly recognized and a folder for it (empty) was created.

----------

The problem was that, when I plugged my external HD to the USB port of my Linux box, the disk was recognized and a folder was created under /media/NewHD , but the folder was empty. NewHD is the label, the name, that I choose when I first formatted my new USB external disk.

To solve I followed these steps:

  1. You have to find the "dev" name of your external HD after you plugged it in:
    dmseg
    You will find something like these lines:

    Initializing USB Mass Storage driver...
    scsi6 : SCSI emulation for USB Mass Storage devices
    Vendor: SAMSUNG Model: HM251JI Rev:
    Type: Direct-Access ANSI SCSI revision: 02
    SCSI device sdc: 488397168 512-byte hdwr sectors (250059 MB)
    sdc: assuming drive cache: write through
    SCSI device sdc: 488397168 512-byte hdwr sectors (250059 MB)
    sdc: assuming drive cache: write through
    sdc: sdc1

    From the last line you know that your external drive was mapped by Linux to the /dev/sdc1

  2. You have to check if the external drive was actually mounted somewhere else:
    mount
    You get something like this:

    [root@hece02] /media $ mount
    /dev/mapper/VolGroup00-LogVol00_Root on / type ext3 (rw)
    none on /proc type proc (rw)
    none on /sys type sysfs (rw)
    none on /dev/pts type devpts (rw,gid=5,mode=620)
    usbfs on /proc/bus/usb type usbfs (rw)
    /dev/sda1 on /boot type ext3 (rw)
    none on /dev/shm type tmpfs (rw)
    /dev/mapper/VolGroup00-LogVol01_Home on /home type ext3 (rw)
    /dev/mapper/VolGroup00-LogVol02_Scratch on /localscratch type ext3 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    AFS on /afs type afs (rw)

    If your /dev/sdc1 is present there, you know that you can access the content of your drive from the path associated with the /dev/sdc1. Otherwise keep following.

  3. You have to mount the external hard disk:
    mount /dev/sdc1 /media/NewHD

  4. And now you can access the content of your disk! :-)

When you have finished, you have to unmount it, before unplugging it from your Linux computer; something like the "Safely Removing" in Windows.
Just type:
umount /media/NewHD
then you can unplug it.

0 commenti: