larsks / blog.oddbit.com

3 stars 0 forks source link

post/2012-10-24-resizing-virtual-disk/ #36

Open utterances-bot opened 7 months ago

utterances-bot commented 7 months ago

Growing a filesystem on a virtual disk :: blog.oddbit.com

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following: You’re using legacy disk partitions. The process for LVM is similar and I will describe that in another post (it’s generally identical except for an additional pvresize thrown in and lvextend in place of resize2fs).

https://blog.oddbit.com/post/2012-10-24-resizing-virtual-disk/

ntzb commented 7 months ago

Hi Lars, can you say what should be done if the partition is not last, but first? in my situation, I've already used qemu-img to resize with +5G.

linux@debian:~$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       8.9G  5.1G  3.4G  61% /

and in root, from fdisk:

root@debian:~# fdisk /dev/vda
...
Command (m for help): p
Disk /dev/vda: 15 GiB, 16106127360 bytes, 31457280 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: dos
Disk identifier: 0x1d220feb

Device     Boot    Start      End  Sectors  Size Id Type
/dev/vda1  *        2048 18970623 18968576    9G 83 Linux
/dev/vda2       18972670 20969471  1996802  975M  5 Extended
/dev/vda5       18972672 20969471  1996800  975M 82 Linux swap / Solaris

p.s. took me a while to find the original post, I wonder why you took the github gist down?