Avatar of Los Angeles1
Los Angeles1
 asked on

RHEL 6 and resize2fs

I performed the following:

[root@ex5b tmp]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_ex5b-lv_root
                      51606140  48632104    352596 100% /
tmpfs                 66073880         0  66073880   0% /dev/shm
/dev/sda1               495844     60297    409947  13% /boot
[root@ex5b tmp]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_ex5b/lv_root
  VG Name                vg_ex5b
  LV UUID                yurcUj-lMPk-DPvL-Voo4-OEtS-Z92g-TPQURp
  LV Write Access        read/write
  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 Name                /dev/vg_ex5b/lv_home
  VG Name                vg_ex5b
  LV UUID                4X2SCc-pTkY-x3mU-sdYY-6LF6-Z9xm-MD6wP0
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/vg_ex5b/lv_swap
  VG Name                vg_ex5b
  LV UUID                I1zVVz-njSc-v4GB-r3VO-X0br-GmPg-PrAWtX
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                128.16 GiB
  Current LE             32808
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

[root@ex5b tmp]# resize2fs  /dev/vg_ex5b/lv_home 40G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vg_ex5b/lv_home to 10485760 (4k) blocks.
The filesystem on /dev/vg_ex5b/lv_home is now 10485760 blocks long.

[root@ex5b tmp]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_ex5b/lv_root
  VG Name                vg_ex5b
  LV UUID                yurcUj-lMPk-DPvL-Voo4-OEtS-Z92g-TPQURp
  LV Write Access        read/write
  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 Name                /dev/vg_ex5b/lv_home
  VG Name                vg_ex5b
  LV UUID                4X2SCc-pTkY-x3mU-sdYY-6LF6-Z9xm-MD6wP0
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/vg_ex5b/lv_swap
  VG Name                vg_ex5b
  LV UUID                I1zVVz-njSc-v4GB-r3VO-X0br-GmPg-PrAWtX
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                128.16 GiB
  Current LE             32808
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Open in new window


Shouldn't home have been resized to 40G, its LV is showing 50GiB
Unix OSLinux

Avatar of undefined
Last Comment
wesly_chen

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
wesly_chen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
woolmilkporc

Hi,

after resize2fs you must run lvreduve to shrink the logical cvolume as well.

lvreduce -L 40G /dev/vg_ex5b/lv_home

wmp
woolmilkporc

Difference betwween lvreduce and lvresize:

lvreduce is used to shrink an LV, while lvresize can be used to shrink as well as to extend a logical volume.

wmp
wesly_chen

OK, you have umount /home.
After lvresize, run resize2fs again
# resize2fs  /dev/vg_ex5b/lv_home
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck