goodfred
June 17th, 2021, 02:23 PM
Hello everyone!
Usually. When I upgrade the hard disk space on a virtual machine on our ESXi I go to the virtual machine settings, upgrade the GB (for example here from 300GB to 600GB) and then I extend the LVM with "lvextend -l +100%FREE /dev/vs00034-vg/root" and "resize2fs /dev/vs00034-vg/root"
After that the partition is as big as it should be.
But this time following is happening:
root@vs00034:~# lvextend -l +100%FREE /dev/vs00034-vg/root
New size (74630 extents) matches existing size (74630 extents)
And logically the 2nd command outputs following:
root@vs00034:~# resize2fs /dev/vs00034-vg/rootresize2fs 1.42.13 (17-May-2015)
Das Dateisystem ist bereits 76421120 (4k) Blöcke lang. Nichts zu tun!
When I think back in my memory there was a column with "free space" on the output of "df -h" - but now I only see this:
root@vs00034:~# df -hFilesystem Size Used Avail Use% Mounted on
udev 3,9G 0 3,9G 0% /dev
tmpfs 799M 17M 782M 3% /run
/dev/mapper/vs00034--vg-root 287G 191G 82G 71% /
tmpfs 3,9G 0 3,9G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup
/dev/sda1 472M 105M 343M 24% /boot
tmpfs 799M 0 799M 0% /run/user/1000
On the following output I have to say that I remember that when I used the command "sfdisk -l" before there wasnt 602GIB on /dev/sda (1st row in the following code)
root@vs00034:~# sfdisk -lDisk /dev/sda: 602 GiB, 646392578048 bytes, 1262485504 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: 0xbdef77f4
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 629143551 628142082 299,5G 5 Extended
/dev/sda5 1001472 629143551 628142080 299,5G 8e Linux LVM
Disk /dev/mapper/vs00034--vg-root: 291,5 GiB, 313020907520 bytes, 611368960 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 /dev/mapper/vs00034--vg-swap_1: 8 GiB, 8585740288 bytes, 16769024 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
Maybe there are 602GIB because I have tried the command "growpart /dev/sda 5" which was executed sucesfully (he was showing the size before the command and the size after. I think it was double. But I dont have the output anymore)
After the "growpart /dev/sda 5" I wanted to try "resize2fs /dev/sda5" (the two commands belong together in the tutorial)
root@vs00034:~# resize2fs /dev/sda5resize2fs 1.42.13 (17-May-2015)
resize2fs: Device or resource busy beim Versuch, /dev/sda5 zu öffnen
Es kann kein gültiger Dateisystem-Superblock gefunden werden.
(this message occured before, too)
Here some additional informations
root@vs00034:~# pvdisplay --- Physical volume ---
PV Name /dev/sda5
VG Name vs00034-vg
PV Size 299,52 GiB / not usable 0
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 76677
Free PE 0
Allocated PE 76677
PV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
root@vs00034:~# lvdisplay --- Logical volume ---
LV Path /dev/vs00034-vg/root
LV Name root
VG Name vs00034-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time vs00034, 2017-06-29 14:44:05 +0200
LV Status available
# open 1
LV Size 291,52 GiB
Current LE 74630
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/vs00034-vg/swap_1
LV Name swap_1
VG Name vs00034-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time vs00034, 2017-06-29 14:44:05 +0200
LV Status available
# open 2
LV Size 8,00 GiB
Current LE 2047
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
root@vs00034:~# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vs00034-vg -wi-ao---- 291,52g
swap_1 vs00034-vg -wi-ao---- 8,00g
In the following section I am 100% sure that the output of sda was 300GB before! (maybe I can fix it myself but I will ask now) (could be because of the "growpart" command!)
root@vs00034:~# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 602G 0 disk
├─sda1 8:1 0 487M 0 part /boot
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 299,5G 0 part
├─vs00034--vg-root 252:0 0 291,5G 0 lvm /
└─vs00034--vg-swap_1 252:1 0 8G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
root@vs00034:~# lvscan ACTIVE '/dev/vs00034-vg/root' [291,52 GiB] inherit
ACTIVE '/dev/vs00034-vg/swap_1' [8,00 GiB] inherit
Again in the following part! 602GB detected! (maybe the "growpart" command ...)
root@vs00034:~# lsblk -o NAME,UUID,FSTYPE,SIZE,LABEL,MOUNTPOINTNAME UUID FSTYPE SIZE LABEL MOUNTPOINT
fd0 4K
sda 602G
├─sda1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ext2 487M /boot
├─sda2 1K
└─sda5 xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx LVM2_member 299,5G
├─vs00034--vg-root xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ext4 291,5G /
└─vs00034--vg-swap_1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx swap 8G [SWAP]
sr0 1024M
root@vs00034:~# vgs VG #PV #LV #SN Attr VSize VFree
vs00034-vg 1 2 0 wz--n- 299,52g 0
root@vs00034:~# pvs PV VG Fmt Attr PSize PFree
/dev/sda5 vs00034-vg lvm2 a-- 299,52g 0
Following rows I have on the output of "cfdisk"
Device - /dev/sda1 Size 487M Type Linux
Device - /dev/sda2 Size 299,5G Type Extended
Device - ->/dev/sda5 Size 299,5G Type Linux LVM
Free space Size 302G
I hope you can help me! I tried reboots of the machine with addind 1GB space before booting again. Did not work.
I tried several commands.
I tried several tutorials.
But I cant expand the LVM of the machine.
Im very very thankful for reading and for answers/tips/etc!
I wish a good left week and weekend!
goodfred
Usually. When I upgrade the hard disk space on a virtual machine on our ESXi I go to the virtual machine settings, upgrade the GB (for example here from 300GB to 600GB) and then I extend the LVM with "lvextend -l +100%FREE /dev/vs00034-vg/root" and "resize2fs /dev/vs00034-vg/root"
After that the partition is as big as it should be.
But this time following is happening:
root@vs00034:~# lvextend -l +100%FREE /dev/vs00034-vg/root
New size (74630 extents) matches existing size (74630 extents)
And logically the 2nd command outputs following:
root@vs00034:~# resize2fs /dev/vs00034-vg/rootresize2fs 1.42.13 (17-May-2015)
Das Dateisystem ist bereits 76421120 (4k) Blöcke lang. Nichts zu tun!
When I think back in my memory there was a column with "free space" on the output of "df -h" - but now I only see this:
root@vs00034:~# df -hFilesystem Size Used Avail Use% Mounted on
udev 3,9G 0 3,9G 0% /dev
tmpfs 799M 17M 782M 3% /run
/dev/mapper/vs00034--vg-root 287G 191G 82G 71% /
tmpfs 3,9G 0 3,9G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup
/dev/sda1 472M 105M 343M 24% /boot
tmpfs 799M 0 799M 0% /run/user/1000
On the following output I have to say that I remember that when I used the command "sfdisk -l" before there wasnt 602GIB on /dev/sda (1st row in the following code)
root@vs00034:~# sfdisk -lDisk /dev/sda: 602 GiB, 646392578048 bytes, 1262485504 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: 0xbdef77f4
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 629143551 628142082 299,5G 5 Extended
/dev/sda5 1001472 629143551 628142080 299,5G 8e Linux LVM
Disk /dev/mapper/vs00034--vg-root: 291,5 GiB, 313020907520 bytes, 611368960 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 /dev/mapper/vs00034--vg-swap_1: 8 GiB, 8585740288 bytes, 16769024 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
Maybe there are 602GIB because I have tried the command "growpart /dev/sda 5" which was executed sucesfully (he was showing the size before the command and the size after. I think it was double. But I dont have the output anymore)
After the "growpart /dev/sda 5" I wanted to try "resize2fs /dev/sda5" (the two commands belong together in the tutorial)
root@vs00034:~# resize2fs /dev/sda5resize2fs 1.42.13 (17-May-2015)
resize2fs: Device or resource busy beim Versuch, /dev/sda5 zu öffnen
Es kann kein gültiger Dateisystem-Superblock gefunden werden.
(this message occured before, too)
Here some additional informations
root@vs00034:~# pvdisplay --- Physical volume ---
PV Name /dev/sda5
VG Name vs00034-vg
PV Size 299,52 GiB / not usable 0
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 76677
Free PE 0
Allocated PE 76677
PV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
root@vs00034:~# lvdisplay --- Logical volume ---
LV Path /dev/vs00034-vg/root
LV Name root
VG Name vs00034-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time vs00034, 2017-06-29 14:44:05 +0200
LV Status available
# open 1
LV Size 291,52 GiB
Current LE 74630
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/vs00034-vg/swap_1
LV Name swap_1
VG Name vs00034-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time vs00034, 2017-06-29 14:44:05 +0200
LV Status available
# open 2
LV Size 8,00 GiB
Current LE 2047
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
root@vs00034:~# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vs00034-vg -wi-ao---- 291,52g
swap_1 vs00034-vg -wi-ao---- 8,00g
In the following section I am 100% sure that the output of sda was 300GB before! (maybe I can fix it myself but I will ask now) (could be because of the "growpart" command!)
root@vs00034:~# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 602G 0 disk
├─sda1 8:1 0 487M 0 part /boot
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 299,5G 0 part
├─vs00034--vg-root 252:0 0 291,5G 0 lvm /
└─vs00034--vg-swap_1 252:1 0 8G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
root@vs00034:~# lvscan ACTIVE '/dev/vs00034-vg/root' [291,52 GiB] inherit
ACTIVE '/dev/vs00034-vg/swap_1' [8,00 GiB] inherit
Again in the following part! 602GB detected! (maybe the "growpart" command ...)
root@vs00034:~# lsblk -o NAME,UUID,FSTYPE,SIZE,LABEL,MOUNTPOINTNAME UUID FSTYPE SIZE LABEL MOUNTPOINT
fd0 4K
sda 602G
├─sda1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ext2 487M /boot
├─sda2 1K
└─sda5 xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx LVM2_member 299,5G
├─vs00034--vg-root xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ext4 291,5G /
└─vs00034--vg-swap_1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx swap 8G [SWAP]
sr0 1024M
root@vs00034:~# vgs VG #PV #LV #SN Attr VSize VFree
vs00034-vg 1 2 0 wz--n- 299,52g 0
root@vs00034:~# pvs PV VG Fmt Attr PSize PFree
/dev/sda5 vs00034-vg lvm2 a-- 299,52g 0
Following rows I have on the output of "cfdisk"
Device - /dev/sda1 Size 487M Type Linux
Device - /dev/sda2 Size 299,5G Type Extended
Device - ->/dev/sda5 Size 299,5G Type Linux LVM
Free space Size 302G
I hope you can help me! I tried reboots of the machine with addind 1GB space before booting again. Did not work.
I tried several commands.
I tried several tutorials.
But I cant expand the LVM of the machine.
Im very very thankful for reading and for answers/tips/etc!
I wish a good left week and weekend!
goodfred