Im trying to remove the added disk to the VM, as the disk space is not needed anymore. However, it looks to be that the VM has in the VG almost all the data used what is available there.
However, i've managed to resize the zoneminder--vg to 6G almost from 1,5TB
with resiz2fs
but lvdisplay says differently.
Here is the output of some commands.
root@zoneminder:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root zoneminder-vg -wi-ao---- 1.52t
swap_1 zoneminder-vg -wi-ao---- 976.00m
root@zoneminder:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 zoneminder-vg lvm2 a-- 900.00g 0
/dev/sda5 zoneminder-vg lvm2 a-- 699.52g 46.57g
root@zoneminder:~# vgs
VG #PV #LV #SN Attr VSize VFree
zoneminder-vg 2 2 0 wz--n- 1.56t 46.57g
DF - H
Filesystem Size Used Avail Use% Mounted on
udev 7.9G 0 7.9G 0% /dev
tmpfs 1.6G 8.9M 1.6G 1% /run
/dev/mapper/zoneminder--vg-root 5.6G 4.9G 431M 92% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sda1 472M 108M 340M 25% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/1000
pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name zoneminder-vg
PV Size 699.52 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 179077
Free PE 11922
Allocated PE 167155
PV UUID SVGqoc-SQ42-tDzp-Qc7H-n90f-1g9n-x0eLWe
--- Physical volume ---
PV Name /dev/sda3
VG Name zoneminder-vg
PV Size 900.00 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 230400
Free PE 0
Allocated PE 230400
PV UUID Cdanv0-2pLJ-Yp2n-3zsl-JvjH-72QS-Ciwhaj
lvdisplay
--- Logical volume ---
LV Path /dev/zoneminder-vg/root
LV Name root
VG Name zoneminder-vg
LV UUID poThtY-v96W-e2Ai-nan7-ckqn-aeBm-T0Kqji
LV Write Access read/write
LV Creation host, time zoneminder, 2018-08-01 22:22:13 +0200
LV Status available
# open 1
LV Size 1.52 TiB
Current LE 397311
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/zoneminder-vg/swap_1
LV Name swap_1
VG Name zoneminder-vg
LV UUID SXQ36r-5Kum-Z3Wa-m9DE-CBVb-h9Wx-kmctKT
LV Write Access read/write
LV Creation host, time zoneminder, 2018-08-01 22:22:13 +0200
LV Status available
# open 2
LV Size 976.00 MiB
Current LE 244
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
vgdisplay
--- Volume group ---
VG Name zoneminder-vg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.56 TiB
PE Size 4.00 MiB
Total PE 409477
Alloc PE / Size 397555 / 1.52 TiB
Free PE / Size 11922 / 46.57 GiB
VG UUID lTo8U0-dIL9-Yye3-RVYk-rJu6-w6WQ-zIpL8f
How can i make the /dev/sda3 remove without hitting any data on the LVM? And then rebuilt the VGroup back again, to 100G or something?
fdisk -l
Disk /dev/sda: 1.6 TiB, 1717986918400 bytes, 3355443200 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: 0x21880f4a
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 1468004351 1467002882 699.5G 5 Extended
/dev/sda3 1468004352 3355443199 1887438848 900G 8e Linux LVM
/dev/sda5 1001472 1468004351 1467002880 699.5G 8e Linux LVM
Partition table entries are not in disk order.
Disk /dev/mapper/zoneminder--vg-root: 1.5 TiB, 1666443116544 bytes, 3254771712 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/zoneminder--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 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
root@zoneminder:~#
Update#1:
@telcoM : Thank you for you kind and detailed answer
All the actions mentioned by you where done.
I came across also that the data was ofcourse spread all over the disk, so I had to physically move the data also:
root@zoneminder:~# pvresize --setphysicalvolume 101G -v /dev/sda5
Using physical volume(s) on command line.
Archiving volume group "zoneminder-vg" metadata (seqno 9).
/dev/sda5: Pretending size is 211812352 not 1467002880 sectors.
Resizing volume "/dev/sda5" to 211812352 sectors.
Resizing physical volume /dev/sda5 from 0 to 25855 extents.
/dev/sda5: cannot resize to 25855 extents as later ones are allocated.
0 physical volume(s) resized / 1 physical volume(s) not resized
root@zoneminder:~# pvs -v --segments /dev/sda5
Using physical volume(s) on command line.
Wiping cache of LVM-capable devices
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges
/dev/sda5 zoneminder-vg lvm2 a-- 699.52g 598.57g 0 25600 root 0 linear /dev/sda5:0-25599
/dev/sda5 zoneminder-vg lvm2 a-- 699.52g 598.57g 25600 141311 0 free
/dev/sda5 zoneminder-vg lvm2 a-- 699.52g 598.57g 166911 244 swap_1 0 linear /dev/sda5:166911-167154
/dev/sda5 zoneminder-vg lvm2 a-- 699.52g 598.57g 167155 11922 0 free
root@zoneminder:~# sudo pvmove --alloc anywhere /dev/sda5:166911-167154 /dev/sda5:25601-25845
/dev/sda5: Moved: 0.4%
/dev/sda5: Moved: 100.0%
root@zoneminder:~# pvresize --setphysicalvolume 101G -v /dev/sda5
Using physical volume(s) on command line.
Archiving volume group "zoneminder-vg" metadata (seqno 12).
/dev/sda5: Pretending size is 211812352 not 1467002880 sectors.
Resizing volume "/dev/sda5" to 211812352 sectors.
Resizing physical volume /dev/sda5 from 0 to 25855 extents.
Updating physical volume "/dev/sda5"
Creating volume group backup "/etc/lvm/backup/zoneminder-vg" (seqno 13).
Physical volume "/dev/sda5" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
root@zoneminder:~# pvs -v --segments /dev/sda5
Using physical volume(s) on command line.
Wiping cache of LVM-capable devices
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges
/dev/sda5 zoneminder-vg lvm2 a-- 101.00g 44.00m 0 25600 root 0 linear /dev/sda5:0-25599
/dev/sda5 zoneminder-vg lvm2 a-- 101.00g 44.00m 25600 1 0 free
/dev/sda5 zoneminder-vg lvm2 a-- 101.00g 44.00m 25601 244 swap_1 0 linear /dev/sda5:25601-25844
/dev/sda5 zoneminder-vg lvm2 a-- 101.00g 44.00m 25845 10 0 free
Actually what I'm trying to achieve is the following (post #18): https://communities.vmware.com/message/2723540#2723540
I'm now stuck at that /dev/sda3
has not been removed, still seeing in fdisk -l
and the size of /dev/sda5
is still 700G.
root@zoneminder:~# fdisk -l
Disk /dev/sda: 1.6 TiB, 1717986918400 bytes, 3355443200 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: 0x21880f4a
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 1468004351 1467002882 699.5G 5 Extended
/dev/sda3 1468004352 3355443199 1887438848 900G 8e Linux LVM
/dev/sda5 1001472 1468004351 1467002880 699.5G 8e Linux LVM
Partition table entries are not in disk order.
Disk /dev/mapper/zoneminder--vg-root: 100 GiB, 107374182400 bytes, 209715200 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/zoneminder--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 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
UPDATE #2:
I've managed via an LIVE-CD to use GPARTED and PARTED to remove the disk and resize the /dev/sda2
wherein also /dev/sda5
is with the LV(M)
Because of the snapshots in ESXi I've made, I need to redo all the steps again. Because the nesteling of the vmdk's are a bit nasty as it seems to be.
It takes a while untill the orignal VM has been copied (1,6TB). After this I will do a full dump of all the steps such that in the future, someone else can use it also.