First time capturing CentOS Linux image - Drive won't shrink
-
I have my image container set to “Single Disk - Resizable” but when I go to capture the image it is capturing the entire 500gb drive. Empty space and all. Is there some command that I need to run on the Linux box before shutting it down?
-
Going to guess CentOS is built on LVM?
-
@tom-elliott I think so yes. How do I tell?
-
@kafluke These commands:
lvdisplay vgdisplay pvdisplay lsblk df -h
-
oot@localhost ~]# lvdisplay --- Logical volume --- LV Path /dev/VolGroup/lv_root LV Name lv_root VG Name VolGroup LV UUID 8eSY96-2DZs-XcRb-P5Yk-6cLC-NgKo-khI0x7 LV Write Access read/write LV Creation host, time localhost.localdomain, 2018-01-31 13:10:22 -0500 LV Status available # open 1 LV Size 50.00 GiB Current LE 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Path /dev/VolGroup/lv_home LV Name lv_home VG Name VolGroup LV UUID wCyqEP-KrM4-Qcfr-5JwM-2i6H-Z3Id-DFuQ9X LV Write Access read/write LV Creation host, time localhost.localdomain, 2018-01-31 13:10:36 -0500 LV Status available # open 1 LV Size 411.41 GiB Current LE 105321 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Path /dev/VolGroup/lv_swap LV Name lv_swap VG Name VolGroup LV UUID rJ669N-nuiy-VzhY-qjpm-QzXc-ljpm-piiPrV LV Write Access read/write LV Creation host, time localhost.localdomain, 2018-01-31 13:11:33 -0500 LV Status available # open 1 LV Size 3.86 GiB Current LE 988 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 [root@localhost ~]# vgdisplay --- Volume group --- VG Name VolGroup System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 465.27 GiB PE Size 4.00 MiB Total PE 119109 Alloc PE / Size 119109 / 465.27 GiB Free PE / Size 0 / 0 VG UUID idHhLk-uM2L-x78s-UkET-3NnG-IaOs-ig2qae [root@localhost ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name VolGroup PV Size 465.27 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 119109 Free PE 0 Allocated PE 119109 PV UUID N3L3CC-tvY8-ueht-ydt2-Kj8o-O6pD-zdmxTd [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 77.7M 0 part /boot └─sda2 8:2 0 465.3G 0 part ├─VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm / ├─VolGroup-lv_swap (dm-1) 253:1 0 3.9G 0 lvm [SWAP] └─VolGroup-lv_home (dm-2) 253:2 0 411.4G 0 lvm /home [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 6.7G 40G 15% / tmpfs 1.9G 0 1.9G 0% /dev/shm /dev/sda1 64M 31M 29M 52% /boot /dev/mapper/VolGroup-lv_home 405G 144M 385G 1% /home
-
What now? How do I get FOG to shrink when capturing?
-
@kafluke said in First time capturing CentOS Linux image - Drive won’t shrink:
How do I get FOG to shrink when capturing?
Looking at the output below, your image is using LVM. Normally this is a good thing and preferred in the Linux world. Unfortunately, fog currently cannot resize an image that uses LVM.
The way to go about making this work for you is to recreate the image but do not use LVM, and ensure all the partitions you create are of the type:
Ext4
orswap
.Everyone who hangs around on these forums is generally really good at Linux partitioning - so if you need some guidance on how to lay it out, we can help you with that, just ask.
-
Okay that was it. Thanks. I reset my image using ext4