Friday, February 15, 2008

Mounting a new hardsikd to linux

Last night I mounted a new disk to the Ubuntu system I am using and here were the steps:
  • using fdisk -l to find out the list of hard drives installed on you computer. then you should get something like the following:
Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

Device Boot Start End Blocks Id System
/dev/sda1 * 1 29637 238059171 83 Linux
/dev/sda2 29638 30394 6080602+ 5 Extended
/dev/sda5 29638 30394 6080571 82 Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000081

Device Boot Start End Blocks Id System
Apparently, the /dev/sdb is not mounted and also not formated.
  • if your hard disk is not formated, you need an extra formating step, I usually just do:
mkfs.ext3 /dev/sdb
  • Create a mount point. I usually load the 2nd driver as the data drive and this command will work
mkdir /data
chmod 777 /data
  • If you want to mount your drive right away( this will not mounted automatically every time you reboot )

mount /dev/sdb /data

  • if you want to mount automatically, you need to add an entry in the /etc/fstab file.
/dev/sdb /data ext3 defaults 0 0
To mount the usb external drive you need to use this:

mount -t vfat /dev/sdc1 /backup
Please note you need to specify the type here as fat. for auto mounting, add this to /etc/fstab
/dev/sdc1 /backup vfat auto,users,rw,umask=0 0 0

Pretty simple!


No comments: