I'm having some problems trying to extend a Disk. I'm using a VMware Debian 9 virtual machine on an ESXi host.
After extending the virtual disk-size by 32 GB and rebooting the VM I see:
bob@apollo:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 64G 0 disk ├─sdb1 8:17 0 16G 0 part /var/lib/jenkins └─sdb2 8:18 0 16G 0 part /var/www bob@apollo:~$ mount | grep sdb /dev/sdb2 on /var/www type ext4 (rw,relatime,data=ordered) /dev/sdb1 on /var/lib/jenkins type ext4 (rw,relatime,data=ordered) bob@apollo:~$ sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.29.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. GPT PMBR size mismatch (67108863 != 134217727) will be corrected by w(rite). GPT PMBR size mismatch (67108863 != 134217727) will be corrected by w(rite). Command (m for help): p Disk /dev/sdb: 64 GiB, 68719476736 bytes, 134217728 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 513133B6-1030-427A-8950-E43374665229 Device Start End Sectors Size Type /dev/sdb1 2048 33554431 33552384 16G Linux filesystem /dev/sdb2 33554432 67106815 33552384 16G Linux filesystem The technique that I've learned about from lurking on this site is to use fdisk to delete the partition and create a new, bigger one. I'm hoping the necessary write will also solve the GPT PMBR size mismatch that I see with fdisk.
bob@apollo:~$ sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.29.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. GPT PMBR size mismatch (67108863 != 134217727) will be corrected by w(rite). GPT PMBR size mismatch (67108863 != 134217727) will be corrected by w(rite). Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 has been deleted. Command (m for help): n Partition number (2-128, default 2): 2 First sector (33554432-67108830, default 33554432): Last sector, +sectors or +size{K,M,G,T,P} (33554432-67108830, default 67108830): 134217728 Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (33554432-67108830, default 67108830): Created a new partition 2 of type 'Linux filesystem' and of size 16 GiB. Partition #2 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: n Command (m for help): w GPT PMBR size mismatch (67108863 != 134217727) will be corrected by w(rite). fdisk: failed to write disklabel: Invalid argument bob@apollo:~$ So a lot of things happened here
- /dev/sdb now has 134,217,728 sectors. But the "valid range" only goes up to the old 67,108,830.
- When I do 'recreate' partition 2 with its original size and try to write the changes, fdisk crashes with 'Invalid argument'.
How can I extend the volume