Linux Troubleshooting Make Easy.

Linux Learning & Troubleshooting Make Easy.

Add secondary Hard Drive in linux

Login to your Server as Root.

Check your hard disk list.
#  fdisk -l

To Create a New Partition:

# fdisk /dev/<new drive>
Ex: fdisk /dev/sdb

  m   display help
   n   add a new partition              
   d   delete a partition
   l   list known partition types
   p   print the partition table
   q   quit without saving changes
   w   write table to disk and exit
   t   change a partition's system id

Linux Partition Types: [ # /sbin/sfdisk -T  ]

81  Minix / old Linux
82  Linux swap / Solaris
83  Linux
85  Linux extended
88  Linux plaintext
8e  Linux LVM
f0  Linux/PA-RISC boot
fd  Linux raid autodetect

Update kernel about newly created partition:
#  partprobe

Format The Partition :
# mke2fs -j /dev/<new drive>

Create Directory to Mount the New partition:
# mkdir /Data

Make a entry in /etc/fstab for new partition:
    /dev/<new drive>     /Data       ext3    defaults        1  2               

Mount the new drive :
#  mount -a

Some other Useful Commands :

#  dumpe2fs /dev/sda    [ shows detailed information about a partition ]
#  blkid /dev/sda        [ shows filesystem type and some more information ]

No comments: