Partitioning a new Hardrive

What is the command to partition a completely new hard drive using red hat linux

  1. Add new disk and reboot the machine
  2. Check to see if the disk is present using ls -l /dev/sd* . If you started with only one disk and added another you should see /dev/sdb
  3. fdisk /dev/sdb and partition the disk. I'd recommend adding primary partition 1 using the entire disk.
  4. reboot the system to let the system create the other necessary device files. In the above case /dev/sdb1.
  5. Check to see if /dev/sdb1 is present. If so, then you can create a filesystem on the disk.
  6. mkfs -t ext3 /dev/sdb1 to create the new filesystem.
  7. I'd do the following also: tune2fs -i 0 -c 0 -m 1 -e panic /dev/sdb1 . This inhibits the inconvient full fscks at mounts after a number of days and/or number of mounts. The system will still fsck the filesystem if necessary. Only reserve 1% of the diskspace for the root user. Otherwise, the default is to basically reserve 10%. Panic the system once filesystem errors are detected, default is to continue operations with the filesystem R/O.
  8. mkdir /mountpoint
    8a. chmod 755 /mountpoint. VERY important.
  9. add to the /etc/fstab:

    /dev/sdb1 /mountpoint ext3 defaults 0 1
  10. Reboot your system and and do a df and see that your mount is present and active.
  11. You are done.
 p // partition list   
:d  // delete
  :n  //new partition
  :1
  :w
  :q    //  I tried and it's done.
1 Like