Adding a new disk to CentOS

For the purpose of this article, assume that /dev/sdb is the new disk that is to be installed.
  • ls /dev/sd* :this will show all available disks
  • Create linux partition on a disk

# su :become root
# fdisk /dev/sdb :/dev/sdb is the new disk that needs to be installed
# In fdisk interface enter c and then u :Change display/entry units to sectors
# Enter p :View current partitions on disk
# Enter n :Create new partition
# Enter 1,2,3 or 4 :No of partitions that you want to create
# Enter e or p :e = extended, p = primary partition
# Enter w :Actually Write / perform the actions to disk

  • ls /dev/sd* :This should show the new partiton e.g. /dev/sdb1
  • Create files system on the new partiton

# /sbin/mkfs.ext4 -L /backup /dev/sdb1

  • 5. mount the filesystem

# mkdir /backup :Create a mountpoint
# mount /dev/sdb1 /backup :Mount the new filesystem at /backup
# mount : Display a list of all currently mounted filesystems

  • Add entry to /etc/fstab so that the new filesystem is automatically mounted at boot time
83 votes

Leave a Reply