Install the following tools using your package manager. For Debian and Ubuntu, run this command if you are using a minimal installation:
sudo apt install parted e2fsprogsparted: "is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS and GPT. It is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks." (from man parted)
mkfs.ext4: Allows creation of Ext4 partitions (like a formatting tool)
df: Report disk space usage
sudo parted -lThe output will be similar to:
Model: Micon_2450_M123132
Disk /dev/sda: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 316MB 315MB fat32 EFI system partition boot, esp
2 316MB 450MB 134MB Microsoft reserved partition msftres
3 450MB 999GB 999GB ntfs Basic data partition msftdata
4 999GB 1000GB 944MB ntfs Basic data partition hidden, diag
5 1000GB 1024GB 24.1GB ntfs Basic data partition hidden, diag
Model: SSD 970 EVO Plus 1TB
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
6 1049kB 886GB 886GB ext4
1 886GB 887GB 524MB fat32 boot, espNote the disk names. They might be /dev/nvme0n1 or something like /dev/sda. Read more about devices at
Open parted pointing to the disk you will edit.
sudo parted /dev/sdbWarning Make sure you are pointing to the correct device, otherwise you might lose data forever.
(parted) mkpart
(parted) Partition type? primary/extended? primary
(parted) File system type? [ext2]? ext4
(parted) Start? 0
(parted) End? 100%
(parted) printYou can use % values for start and end.
The command is quite simple, not much to change around:
sudo mkfs.ext4 /dev/sdb1You should be able to mount the partition at any empty directory. In this example, we will mount it at /mnt/sdb1:
sudo mkdir /mnt/sdb1
sudo mount /dev/sdb1 /mnt/sdb1fstab to mount it every time you boot Add the mount to your fstab file, make sure to point to the proper mount folder:
sudo echo /dev/sdb1 /mnt/sdb1 ext4 defaults 0 0 >>/etc/fstabYou can restart your computer, and the disk should remain available.
df -hThere is also a graphical version of parted: gparted.