FS extend and FS reduce in RHEL 4 ??

How to reduce FS size in RHEL4 ??

Step 1: umount /fs
step 1: e2fsck -f /dev/vg??/lvol??
Step 2: resize2fs /dev/vg??/lvol?? "New Size"
step 3: lvreduce -L "new Size" /dev/vg??/lvol??
step 4: mount /fs

Example i have reduced /mnt/u001 FS size from 58GB to 50GB. Check the below output

ServerA:/tmp# umount /mnt/u001

ServerA:/tmp# e2fsck -f /dev/mapper/vg01-lvol0
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg01-lvol0: 254375/7602176 files (0.4% non-contiguous), 8528446/15204352 blocks

ServerA:/tmp# resize2fs /dev/mapper/vg01-lvol0 50G
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/mapper/vg01-lvol0 to 13107200 (4k) blocks.

The filesystem on /dev/mapper/vg01-lvol0 is now 13107200 blocks long.


ServerA:/tmp# lvreduce -L 50G /dev/mapper/vg01-lvol0
  WARNING: Reducing active logical volume to 50.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvol0? [y/n]: y
  Reducing logical volume lvol0 to 50.00 GB
  Logical volume lvol0 successfully resized
ServerA:/tmp# lvdisplay /dev/mapper/vg01_app-lvol0
  --- Logical volume ---
  LV Name                /dev/vg01/lvol0
  VG Name                vg01
  LV UUID                ZbIk91-8OUL-Wleo-MfzZ-QkvV-A2c2-amKGil
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                50.00 GB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:35


Now FS size 

serverA:/tmp# df -hP /mnt/u001
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg01-lvol0   50G   32G   16G  67% /mnt/u001

How to extend a FS in RHEL 4??

Step 1 : lvextend -L +size "lvolname"
Step 2 : ext2online "lvolname"

serverA:/tmp# lvextend -L +5G /dev/mapper/vg01_app-lvol8
  Extending logical volume lvol8 to 90.98 GB
  Logical volume lvol8 successfully resized

serverA:/tmp# ext2online /dev/mapper/vg01_app-lvol8
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b

serverA:/tmp# df -hP /mnt/u006
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg01_app-lvol8   90G   81G  7.7G  92% /mnt/u006

Post a Comment