How to add a new partition to a Linux server

Quick guide TLDR;

First use `fdisk -l` to see what is the new empty partition:

fdisk -l

Then when you enter fdisk, create new partition and accept all the defaults. At the end w to exit and write.

fdisk /dev/sdb

Then make a file system, create a empty disk area, mount the disk there, and modify fstab so that when you reboot the disk is present again.

mkfs.ext4 /dev/sdb1
mkdir /mnt/backup
mount /dev/sdb1 /mnt/backup
vi /etc/fstab

Add this:

/dev/sdb1	/data	ext4	defaults     0   0

If you want to do LVM, see here:

Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top