Old question but still no proper answer
How to make partition from free space at the end of disk.
- add partition on free space at the end of disk
- Look around in our disks ( CentOS Linux release 7.9.2009, parted (GNU parted) 3.1 )
[root@test-vm ~]# parted /dev/sda print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 161GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary ext4 boot
2 525MB 51,6GB 51,1GB primary ext4
3 51,6GB 53,7GB 2097MB primary linux-swap(v1)
53,7GB 161GB 107GB Free Space
- We see our client
53,7GB 161GB 107GB Free Space.
Make partition with oneliner
[root@test-vm ~]# parted /dev/sda mkpart primary ext4 53,7GB 161GB
# or parted /dev/sda mkpart primary ext4 53,7GB 100%
Information: You may need to update /etc/fstab.
- Check it
[root@test-vm ~]# parted /dev/sda print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 161GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary ext4 boot
2 525MB 51,6GB 51,1GB primary ext4
3 51,6GB 53,7GB 2097MB primary linux-swap(v1)
4 53,7GB 161GB 107GB primary
That is it. After it you can add it to LVM or just create filesystem on it.
On later versions of parted ( parted (GNU parted) 3.3
) and systems like Ubuntu 20.04.6 LTS output differs ( there is no Type table, but syntax the same)
oot@ubuntu:~# parted /dev/vda print free
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
14 1049kB 5243kB 4194kB bios_grub
15 5243kB 116MB 111MB fat32 boot, esp
1 116MB 10.0GB 9884MB ext4
10.0GB 21.5GB 11.5GB Free Space
root@ubuntu:~# parted /dev/vda mkpart primary ext4 10.0GB 21.5GB
Information: You may need to update /etc/fstab.
root@ubuntu:~# parted /dev/vda print free
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
14 1049kB 5243kB 4194kB bios_grub
15 5243kB 116MB 111MB fat32 boot, esp
1 116MB 10.0GB 9884MB ext4
10.0GB 10.0GB 269kB Free Space
2 10.0GB 21.5GB 11.5GB primary
21.5GB 21.5GB 1032kB Free Space