Without Adding New Storage Capacity, How Do You Create a Partition?

Problem scenario
You have no new physical disks, but you want to partition an existing Linux system. What do you do to benefit from logical partitions on an existing Linux machine?

Solution (with important warning)

WARNING: THIS CAN MAKE YOUR LINUX MACHINE UNBOOTABLE.

DON'T DO IT UNLESS YOU KNOW WHAT YOU ARE DOING.
(The solution below was influenced by this external site.)

sudo fdisk -l

You should see something like this:
Device       Start      End  Sectors Size Type
/dev/sdc4     2048     4095     2048   1M BIOS boot
/dev/sdc5     4096  2101247  2097152   1G Linux filesystem
/dev/sdc6  2101248 20969471 18868224   9G Linux filesystem

Run this:
sudo fdisk /dev/sdc6

Respond to the prompts: n for new. Use "e" for extended. Accept the default patition number and First sector. For the Last sector use +200M or +2G (the number of MB or GB you want the partition to have). If you get a prompt about removing the ext4 signature, we recommend responding with "N" so you do not change it. Use the "w" response at the end to save it. You'll need to reboot the server.

Here are commands and output that you may see:

jdoe@ubuntuserver:~$ sudo fdisk /dev/sda3

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old LVM2_member signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x73327c7c.

Command (m for help): 2           
2: unknown command

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (1-4, default 1): 
First sector (2048-18868223, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-18868223, default 18868223): +1G

Created a new partition 1 of type 'Extended' and of size 1 GiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y           

The signature will be removed by a write command.

Command (m for help): q

jdoe@ubuntuserver:~$ sudo parted -l

Leave a comment

Your email address will not be published. Required fields are marked *