Creating a Boot Partition on Extended Root Device (GPT)
After resizing the VM with growfs
disabled, create and format the new partition.
Important: You must extend the disk, see Creating a Boot Partition in Microsoft Azure.
The following example creates a GPT
partition.
# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): x
Expert command (? for help): e
Relocating backup data structures to the end of the disk
Expert command (? for help): m
Command (? for help): p
Disk /dev/sda: 65011712 sectors, 31.0 GiB
Model: Virtual Disk
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 4BE72FBF-27EC-46C1-AA51-D9AB03EFC2B6
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 65011678
Partitions will be aligned on 2048-sector boundaries
Total free space is 2099166 sectors (1025.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 227328 62914526 29.9 GiB 8300
14 2048 10239 4.0 MiB EF02
15 10240 227327 106.0 MiB EF00
The new boot partition should start at least 1 sector after the first partition ends. In this example, the new partition should start on sector 62914527 or higher.
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-65011678, default = 62914560) or {+-}size{KMGTP}:
In this example the default is acceptable because it is higher than 62914527 and it is aligned on a 2048-sector boundary. If the system default for the first sector is not valid, enter a sector number one higher than the end of the first partition. The system will automatically increase that value to align on the proper sector boundary if required.
After the first sector is configured correctly, you can accept the default for the last sector.
Last sector (62914560-65011678, default = 65011678) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 0700
Changed type of partition to 'Microsoft basic data'
Command (? for help): p
Disk /dev/sda: 65011712 sectors, 31.0 GiB
Model: Virtual Disk
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 4BE72FBF-27EC-46C1-AA51-D9AB03EFC2B6
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 65011678
Partitions will be aligned on 2048-sector boundaries
Total free space is 2047 sectors (1023.5 KiB)
Number Start (sector) End (sector) Size Code Name
1 227328 62914526 29.9 GiB 8300
2 62914560 65011678 1024.0 MiB 0700 Microsoft basic data
14 2048 10239 4.0 MiB EF02
15 10240 227327 106.0 MiB EF00
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
# reboot
After VM has rebooted, you can format the new partition with ext3
or ext4
.