So very recently we needed to quickly get a new 3TB HDD set-up in Cent OS 7 as a backup server. We couldn’t afford the time to spend an age on it so when with the simple and powerful fdisk. I decided to write this so that I don’t forget how I did it, as is likely to happen.
- Identify the device, we used fdisk -l and was able to identify the drive: /dev/sdb
- Create the partition, fdisk /dev/sdb then use option p, n, and w (w is important as it actually makes the changes, otherwise they get lost when fdisk quits)
- Make the ext4 filesystem on partition, mkfs -t ext4 /dev/sdb1 (the 1 refers to the partition)
- Create a mount point, Simply just need to create a folder with which to mount the drive into, we used /mnt/backup_drive
- Mount the partition (temporily), mount /dev/sdb1 /mnt/backup_drive – this let us know it all worked
- Make the mount permanent, Edit fstab (I like to use nano but there are other ways to do this) nano /etc/fstab (you need to sudo for this to work) and enter a line like this:
/dev/sdb1 /mnt/backup_drive ext4 defaults 0 0
You may see other lines similar to this, some systems refer to the drives using the UUID instead, admittedly I don’t know enough about that to comment other than I rememer reading that the UUID is very unique. When I discover more I shall post about it on here.