How to Partition a New Disk Drive

0. Create virtual disk in machine BIOS.

Choose the RAID type you want it to be, e.g. RAID0, RAID1, RAID10, RAID5.

1. Check existing partitions

And identify the new disk you want to format, e.g. /dev/sdb

1
% sudo fdisk -l

2. Create or modify partitions

Run fdisk to manage disk partition

1
% sudo fdisk /dev/sdb
  • Press m to view available commands.
  • Press n to create a new partition.
  • Follow prompts to set partition size.
  • Press w to save the change.

3. Format the partition

Choose a filesystem type (e.g. xfs, ext4) and format the partition:
Use xfs for high-performance needs or ext4 for general use.

1
% sudo mkfs.xfs /dev/sdb1

4. Mount the partition

1
2
% sudo mkdir /opt/work
% sudo mount /dev/sdb1 /opt/work

5. Configure auto-mount and check filesystem

1
2
3
% sudo echo "/dev/sdb1 /mnt/mydisk ext4 defaults 0 0" >> /etc/fstab
% lsblk
% df -hT