Re: Total free space using added VGs and LVs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I read the How-To. It doesn't talk about the specific case or being mounted at root, so I had to experiment. It is likely that commands were in the wrong order, but I don't know what the right order is.
 
I have attached the terminal session I used. In the end it did not work. There was still 66 GB free, and when I rebooted, the file system failed. The superblock was too big.
 
I obviously don't understand the difference between pvresize, lvreduce and vgreduce, and how  resize2fs  is related to these commands.
 
Hope you can help,
Lou.

 
On 10/21/09, Drew <drew.kay@gmail.com> wrote:
> The documentation wasn't specific. I believe the intent was simply to
> migrate the data to another logical volume to temporarily allow the source
> volume to be reduced and/or removed. But let's assume that has happened or
> that doesn't need to happen. So now we need to unmount LogVol00, reduce it
> to its original nunber of extents and then remount it (either before or
> after remount we remove the physical drive.) I assume you can't try this or
> you'll screw up your computer, but I have a system that I screw up and
> easily restore from a OS image. So no need to be too cautious.

I've done this on several occasions.

If you want to play with various scenarios in LVM, I'd recommend
reading the LVM How-To @ http://tldp.org/HOWTO/LVM-HOWTO/ . Sections
11 & 13 cover the most common tasks you'll encounter in LVM. Play
around, don't be afraid to break things, and if you have questions
feel free to give the list a shout.


--
Drew

"Nothing in life is to be feared. It is only to be understood."
--Marie Curie

[root@shoe ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  7
  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               75.16 GB
  PE Size               32.00 MB
  Total PE              2405
  Alloc PE / Size       2405 / 75.16 GB
  Free  PE / Size       0 / 0   
  VG UUID               jvz6xK-OCTu-NUfb-5ssk-QHEI-KosC-PHiJff
   
[root@shoe ~]# pvdisplay /dev/hdd
  --- Physical volume ---
  PV Name               /dev/hdd
  VG Name               VolGroup00
  PV Size               38.02 GB / not usable 19.05 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1216
  Free PE               0
  Allocated PE          1216
  PV UUID               ggSPj8-N36N-dtC1-U5sL-pw23-ubGj-AdF9H3
   
[root@shoe ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       72G  2.2G   67G   4% /
/dev/hda1              99M   18M   76M  19% /boot
tmpfs                 252M     0  252M   0% /dev/shm

[root@shoe ~]# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               37.17 GB / not usable 12.24 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1189
  Free PE               0
  Allocated PE          1189
  PV UUID               vEuKec-0sYh-6H3u-30Ld-Aq1S-UyWN-i6vwEr
   
  --- Physical Segments ---
  Physical extent 0 to 1156:
    Logical volume      /dev/VolGroup00/LogVol00
    Logical extents     0 to 1156
  Physical extent 1157 to 1188:
    Logical volume      /dev/VolGroup00/LogVol01
    Logical extents     0 to 31
   
  --- Physical volume ---
  PV Name               /dev/hdd
  VG Name               VolGroup00
  PV Size               38.02 GB / not usable 19.05 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1216
  Free PE               0
  Allocated PE          1216
  PV UUID               ggSPj8-N36N-dtC1-U5sL-pw23-ubGj-AdF9H3
   
  --- Physical Segments ---
  Physical extent 0 to 1215:
    Logical volume      /dev/VolGroup00/LogVol00
    Logical extents     1157 to 2372
   
[root@shoe ~]# pvresize --setphysicalvolumesize 00G /dev/hdd
  Physical volume "/dev/hdd" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@shoe ~]# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               37.17 GB / not usable 12.24 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1189
  Free PE               0
  Allocated PE          1189
  PV UUID               vEuKec-0sYh-6H3u-30Ld-Aq1S-UyWN-i6vwEr
   
  --- Physical Segments ---
  Physical extent 0 to 1156:
    Logical volume      /dev/VolGroup00/LogVol00
    Logical extents     0 to 1156
  Physical extent 1157 to 1188:
    Logical volume      /dev/VolGroup00/LogVol01
    Logical extents     0 to 31
   
  --- Physical volume ---
  PV Name               /dev/hdd
  VG Name               VolGroup00
  PV Size               38.02 GB / not usable 18.86 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1216
  Free PE               0
  Allocated PE          1216
  PV UUID               ggSPj8-N36N-dtC1-U5sL-pw23-ubGj-AdF9H3
   
  --- Physical Segments ---
  Physical extent 0 to 1215:
    Logical volume      /dev/VolGroup00/LogVol00
    Logical extents     1157 to 2372
   
[root@shoe ~]# pvremove -ff /dev/hdd
Really WIPE LABELS from physical volume "/dev/hdd" of volume group "VolGroup00" [y/n]? y
  WARNING: Wiping physical volume label from /dev/hdd of volume group "VolGroup00"
  Can't open /dev/hdd exclusively - not removing. Mounted filesystem?

[root@shoe ~]# lvreduce -l -1216 /dev/mapper/VolGroup00-LogVol00
  WARNING: Reducing active and open logical volume to 36.16 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol00? [y/n]: y
  Reducing logical volume LogVol00 to 36.16 GB
  Logical volume LogVol00 successfully resized

[root@shoe ~]# pvremove -ff /dev/hdd
Really WIPE LABELS from physical volume "/dev/hdd" of volume group "VolGroup00" [y/n]? y
  WARNING: Wiping physical volume label from /dev/hdd of volume group "VolGroup00"
  Labels on physical volume "/dev/hdd" successfully wiped

[root@shoe ~]# vgreduce --removemissing VolGroup00
  Couldn't find device with uuid 'ggSPj8-N36N-dtC1-U5sL-pw23-ubGj-AdF9H3'.
  Couldn't find device with uuid 'ggSPj8-N36N-dtC1-U5sL-pw23-ubGj-AdF9H3'.
  Wrote out consistent volume group VolGroup00
--Its not clear why these messages come out. The PV is not there according to the LVM GUI.

[root@shoe ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  10
  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               37.16 GB
  PE Size               32.00 MB
  Total PE              1189
  Alloc PE / Size       1189 / 37.16 GB
  Free  PE / Size       0 / 0   
  VG UUID               jvz6xK-OCTu-NUfb-5ssk-QHEI-KosC-PHiJff
   
[root@shoe ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                Q1ygc0-I2zj-1hQU-gDAa-MdzK-tTaP-gLHzLt
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                36.16 GB
  Current LE             1157
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                PUGBXZ-RHX2-gdIR-kQSG-q8ct-2N1y-P555uJ
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
[root@shoe ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               37.17 GB / not usable 12.24 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              1189
  Free PE               0
  Allocated PE          1189
  PV UUID               vEuKec-0sYh-6H3u-30Ld-Aq1S-UyWN-i6vwEr

[root@shoe ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       72G  2.2G   67G   4% /
/dev/hda1              99M   18M   76M  19% /boot
tmpfs                 252M     0  252M   0% /dev/shm
--You can see that there is still something wrong here, because VolGroup00-LogVol00 is still marked as 67G Available and of course its not. How do we fix that.


_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux