Link to home
Start Free TrialLog in
Avatar of chuckbeats
chuckbeats

asked on

LVM LVEXTEND LVREDUCE

I need to resize a logical volume group.
I need to lvreduce LogVolGroup00-LogVol00 - 130G, curently 136G
I need to lvextend LogVolGroup00-LogVol02 - 12G, currently 6G

They are both part of the same Logical Volume Group. We have only one 300G hard-drive [sda] with two partitions [sda1 (/boot 100M,)] [sda2, the rest - LV]

All the Logical Volumes - only the one Group - are obviously on sda2 - do I need to worry about anything besides the LVREDUCE and LVEXTEND commands. I know I don't need to resize the partition, but do I risk any data loss doing this? Is there anything else I need to do before I resize the LVs.
Avatar of RichardSlater
RichardSlater
Flag of United Kingdom of Great Britain and Northern Ireland image

Yes you do have to worry about data loss, you didn't mention what Operating System you were using or which version of LVM you have implemented. Broadly you need to use the `resize2fs` command to resize a ext2 or ext3 file system, other types of file system will have different commands. Get back to us with more information about your environment and we will see what more we can do for you.
Avatar of chuckbeats
chuckbeats

ASKER

Thanks. There's some more info below - fdisk readout, lvm stuff, etc. But the question I still have, is how do I resize a filesystem when there is only 1 partition in the Logical Volume: sorry I'm kind of new at this - as if that wasn't obvious. Is each mount point/logical volume a serperate file system? I need to make  /var larger and the /home smaller - /var/logs is out of room to log http events. Thanks in advance

Anyway here's some printoust: hope it helps:

*******fdisk /dev/sda - then p to print partition table:

Disk /dev/sda: 799.9 GB, 799977504768 bytes
255 heads, 63 sectors/track, 97258 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       97258   781120462+  8e  Linux LVM

*******LVM PRINTOUT***********

lvm> vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   3   0 wz--n- 744.91G    0


lvm> vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2

lvm> lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%
  LogVol00 VolGroup00 -wi-ao  20.28G
  LogVol01 VolGroup00 -wi-ao   1.94G
  lvHome   VolGroup00 -wi-ao 722.69G

*************df -h printout ************************

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       20G  1.3G   18G   7% /
/dev/mapper/VolGroup00-lvHome
                      723G  633G   90G  88% /home
/dev/sda1              99M   23M   72M  24% /boot
none                  2.0G     0  2.0G   0% /dev/shm
10.2.100.10:/Backup   449G  360G   89G  81% /mnt/backup




PLEASE IGNORE ABOVE PRINTOUTS: WRONG SYSTEM  - THAT IS THE MAIL SERVER
BELOW IS THE CORRECT SERVER PRINTOUS

*******fdisk /dev/sda - then p to print partition table:

Disk /dev/sda: 182.0 GB, 182090465280 bytes
255 heads, 63 sectors/track, 22137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       22137   177711030   8e  Linux LVM



*******LVM PRINTOUT***********
lvm> vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   5   0 wz--n- 169.47G 32.00M

lvm> vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2



lvm> lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%
  LogVol00 VolGroup00 -wi-ao  14.66G
  LogVol01 VolGroup00 -wi-ao   1.94G
  LogVol02 VolGroup00 -wi-ao   9.78G
  LogVol03 VolGroup00 -wi-ao   4.91G
  LogVol04 VolGroup00 -wi-ao 138.16G

lvm> lvscan
  ACTIVE            '/dev/VolGroup00/LogVol00' [14.66 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol04' [138.16 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol03' [4.91 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol02' [9.78 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GB] inherit









*************df -h printout ************************
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       15G  2.2G   12G  16% /
/dev/sda1              99M   19M   75M  21% /boot
none                 1014M     0 1014M   0% /dev/shm
/dev/mapper/VolGroup00-LogVol04
                      136G   88G   42G  68% /home
/dev/mapper/VolGroup00-LogVol03
                      4.9G  9.9M  4.6G   1% /tmp
/dev/mapper/VolGroup00-LogVol02
                      9.7G  9.2G     0 100% /var
Can you tell us what file system you are using on the LVs you want to change:

Run:
> grep VolGroup00 /etc/fstab
grep VolGroup00 /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
/dev/VolGroup00/LogVol04 /home                   ext3    defaults        1 2
/dev/VolGroup00/LogVol03 /tmp                    ext2    defaults        1 2
/dev/VolGroup00/LogVol02 /var                    ext3    defaults        1 2
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

Thanks again!
ASKER CERTIFIED SOLUTION
Avatar of RichardSlater
RichardSlater
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have been using experts-exchange for several years now - this is the best, most precise and concise answer I have ever recieved. Thanks a million!!!!!!!!
Glad I could help :)