1

During the installation of my ubuntu server, I had to leave a big space of my hard drive for specific service. Well, I forgot to to partition it up and leave it mounted during installation. Right Now, I realized I won't be able to use it without being partitioned.

(parted) print free
 Model: DELL PERC 6/i (scsi)
 Disk /dev/sda: 292GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos

 Number  Start   End     Size    Type      File system     Flags
         32.3kB  1049kB  1016kB            Free Space
  1      1049kB  500MB   499MB   primary   ext2            boot
  2      500MB   26.3GB  25.8GB  primary   ext3
         26.3GB  26.3GB  1048kB            Free Space
  3      26.3GB  32.3GB  5999MB  extended
  5      26.3GB  32.3GB  5999MB  logical   linux-swap(v1)
         32.3GB  292GB   260GB             Free Space

What I'mmona need to do, is partition that indicated "Free Space" as well as mount it on a certain /dev/sd* device in order to use it. Any help with that?

mehdix_
  • 301
  • 1
  • 3
  • 9

3 Answers3

1

You might want to look into into fdisk instead of parted.

Personally I use fdisk when it comes to raw partitioning without LVM, because I find it slimmer than parted. But that is only personal preference.

Anyways fdisk is pretty straightforward. Just type fdisk an once you have the fdisk promt press m. The rest ist self explanatory I think. If you need guidance see the link to the TLDP, that should guide you through the process.

Thorian93
  • 303
  • 2
  • 9
0

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
  1. 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

  1. 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.
  1. 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

  1. That is it. After it you can add it to LVM or just create filesystem on it.

  2. 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

0

If you just want to create a new partition install and run Gparted,

sudo apt-get install gparted