Problem:
I want to shrink my LVM system to occupy 40G on an 80G drive so that I can clone it to an empty 40G.
Background:
I installed FC6 on an 80G drive, accepted default partition sizes (who am I to argue with Linux?), and set up my server. To keep it safe, I cloned the 80G (using G4U -basically the dd command) on to a 320G that I could safely "mess with". The 320G has since evolved into the system I want to run, so I need to clone it onto a 40G for daily use and abuse. G4U won't clone a big drive onto a small one.
Rather than risk ruining my 320G, I will try to shrink the less valuable 80G and then G4U it on to the empty 40G. There is more than enough space on the 40G to hold my stuff. If this works, I will apply the method to move 320G to 40G.
THIS IS MY 80G DRIVE: Filesystem ext3
********************************************************************
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 9729 78043770 8e Linux LVM
********************************************************************
HERE'S LVM INFO:
********************************************************************
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
71G 3.6G 64G 6% /
/dev/hda1 99M 17M 78M 18% /boot
tmpfs 490M 0 490M 0% /dev/shm
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 74.41 GB
PE Size 32.00 MB
Total PE 2381
Alloc PE / Size 2380 / 74.38 GB
Free PE / Size 1 / 32.00 MB
VG UUID 1VTA50-C4sx-BAPf-VJAr-iOo8-dW0m-UgLmGD
********************************************************************
I think that shrinking my LV00 to 37 will allow me to clone it to the 40G using G4U.
Following your example (WhatsHisName), I think I need to do this:
1) Boot with "linux rescue" option
2) resize2fs /dev/VG00/LV00 37G
3) lvm lvresize -L 38G /dev/VG00/LV00
4) Clone this to the 40G drive where I will then:
5) lvm lvresize -L 40G /dev/VG00/LV00
6) resize2fs /dev/VG00/LV00
Did I get it right ?
Is there a better way to move my server to a smaller drive?
Thanks.
PS: What do you think of this method:
http://forums.fedoraforum.org/forum/...t=lvm+commands