Unable to extend KVM disk, resize2fs not working

Nisamudeen

Active Member
Apr 28, 2017
35
2
28
37
I am unable to Enlarge the file system which is not configured as LVM. I am getting the below message while trying to do "resize2fs"

resize2fs /dev/vda1
resize2fs 1.42.5 (29-Jul-2012)
The filesystem is already 12563712 blocks long. Nothing to do!

I am attaching detailed screen shot of disk settings. Please check it. I am expecting a solution for the same. We are having "166.4 GB" disk which is mounted as Disk /dev/vda:


df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 48G 45G 693M 99% /
udev 10M 0 10M 0% /dev
tmpfs 2.4G 240K 2.4G 1% /run
/dev/disk/by-uuid/05bbac58-c106-4868-8d96-37037db6a38b 48G 45G 693M 99% /


fdisk -l

Disk /dev/vda: 166.4 GB, 166429982720 bytes
255 heads, 63 sectors/track, 20233 cylinders, total 325058560 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
Disk identifier: 0x000105ea

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 100511743 50254848 83 Linux
/dev/vda2 100513790 104855551 2170881 5 Extended
/dev/vda5 100513792 104855551 2170880 82 Linux swap / Solaris


I am also attaching screen shot of each above. I am expecting a solution to fix the case. My main Proxmox Virtual Environment is 4.2-2/725d76f0


disk in proxmox.png

resize2fs.png


disk.png
 
resize2fs only resizes the filesystem, not the partiton, so you do have to do this first

you can only extend partitions into unused space, and this is all at the end of the disk (so you can only extend /dev/vda2)

you can remove /dev/vda2 and /dev/vda5, enlarge /dev/vda1 and then recreate the swap partition

after all that, resize2fs should work
 
Hi,

Thanks for the update. So in my case, I have to remove the "/dev/vda2" and "/dev/vda5" and then I can extend the disk to 155GB using resize2fs right ?
 
Hi,

There is only one partition now. Still extending is not working.

root@w01:~# resize2fs /dev/vda1
resize2fs 1.42.5 (29-Jul-2012)
The filesystem is already 12563712 blocks long. Nothing to do!

root@w01:~#
root@w01:~#
root@w01:~# fdisk -l /dev/vda

Disk /dev/vda: 166.4 GB, 166429982720 bytes
255 heads, 63 sectors/track, 20233 cylinders, total 325058560 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
Disk identifier: 0x000105ea

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 100511743 50254848 83 Linux
 
Hi,

There is only one partition now. Still extending is not working.

root@w01:~# resize2fs /dev/vda1
resize2fs 1.42.5 (29-Jul-2012)
The filesystem is already 12563712 blocks long. Nothing to do!

root@w01:~#
root@w01:~#
root@w01:~# fdisk -l /dev/vda

Disk /dev/vda: 166.4 GB, 166429982720 bytes
255 heads, 63 sectors/track, 20233 cylinders, total 325058560 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
Disk identifier: 0x000105ea

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 100511743 50254848 83 Linux
Hi,
yes you have one partition only, but this partition has the same size!

I hope you have used swapoff before your remove the swap-partition?!.

And you should have an valid backup of the vm!
To extend the partition you must delete partition 1 and recreate partition 1 with more space.
Like this to use 160GB:
Code:
fdisk /dev/vda
unit s
# delete partition 1
del 1
# recreate partition 1
new
p
1
2048
+160G
# create swap
new
p
# select defaults
# change type to swap
t 2
82
# look is all ok
print
# if yes write partition table
write
if you have used swapoff before - and only then go furthe without reboot. (otherwise comment the swap-entry in fstab and reboot).

Code:
mkswap -f /dev/vda2
blkid /dev/vda2

# use the blkid for the swap-entry in /etc/fstab
# check with
swapon -a
now you can use your resize2fs!

Of course you can let do an tool like partitionmagic this steps for you.

Udo
 
Hi,

Thanks for the update. I have gone through your update. The current server is our live server and we cannot tolerate data loss. While doing partition deletion, we will be loosing our data right ?
 
Why not connect a new vdisc and copy/move the data there?
Then you mount it on the same place the data was before and you should be fine.
 
Hi,

Thanks for your clarification. I have followed a different plan to solve my case as there is no more free disk available in my main node. I have followed below plan and fixed the case.

1. Removed swap partition.
2. Shudown the VM
3. Booted again using gparted ISO
4. Extended the disk using graphical steps. Dragged the disk to right side. See the vedio attached for detailed information.
5. Saved it. Shutdown server and booted from disk.

df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 153G 47G 99G 33% /
udev 10M 0 10M 0% /dev
tmpfs 2.4G 232K 2.4G 1% /run

 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!