Resize LVM ReiserFS Partition

Mucking about with LVM and partitions isn’t really taxing, it’s all well documented. Trusting it however is a different matter. I’ve resized loads of Ext3 LVM partitions in the past, but was asked to resize a ReiserFS one today, which made me ask the question:

Is there anything writing to it currently, as I will have to unmount it first ..

Wrong assumption, or so says the guy sat next to me! ReiserFS can be dynamically resized on the fly! Woohoo says I, lets have a look at the resize_reiserfs man page!

DESCRIPTION
The resize_reiserfs tool resizes an unmounted reiserfs file system.

“Are you sure?” I ask .. “Yes”, he promises!

anise:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lv_slot_bbocp
10G 6.0G 4.1G 60% /opt/sem/slot/bbocp
anise:~# lvdisplay /dev/vg00/lv_slot_bbocp
--- Logical volume ---
LV Name /dev/vg00/lv_slot_bbocp
VG Name vg00
LV UUID P9nb4N-ED0Q-jSWh-xLbs-zP72-5QXL-DbyHiM
LV Write Access read/write
LV Status available
# open 2
LV Size 10.00 GB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:11
anise:~# vgdisplay vg00
--- Volume group ---
VG Name vg00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 35
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 13
Open LV 12
Max PV 0
Cur PV 1
Act PV 1
VG Size 219.83 GB
PE Size 4.00 MB
Total PE 56276
Alloc PE / Size 53762 / 210.01 GB
Free PE / Size 2514 / 9.82 GB
VG UUID HDU1Dc-5i7l-wyGE-cEdM-YpdG-kskb-nw0JWm

There is 9GB of free space in the volume group, and our partition wants to grow by 5GB so thats Ok! Lets do this!

anise:~# lvextend -L+5G /dev/vg00/lv_slot_bbocp
Extending logical volume lv_slot_bbocp to 15.00 GB
Logical volume lv_slot_bbocp successfully resized
anise:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lv_slot_bbocp
10G 6.0G 4.1G 60% /opt/sem/slot/bbocp

No change yet though! Lets do the resize, with it still mounted!!

anise:~# resize_reiserfs -f /dev/vg00/lv_slot_bbocp
resize_reiserfs 3.6.19 (2003 www.namesys.com)
resize_reiserfs: On-line resizing finished successfully.
anise:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lv_slot_bbocp
15G 6.0G 9.1G 40% /opt/sem/slot/bbocp

Woo hoo! We did it, well it’s 15GB in size, and apparently all the data is still there and working and not corrupt. Rejoice. Someone really needs to update that man page!!!

About rus

Hi, I'm Rus and after 10 years of Linux administration and software development, in September 2014 I quit my day job, sold all my stuff and moved to Thailand to live the good life.My new website, http://www.ruspow.com shows how I'm making money online as well as what life can be like when you're not sat behind a desk and are free to make your own decisions!

,

  • lroyb

    Thanks, worked a treat. and Tons easier than the other ‘guides’ i’ve read.
    This is deffo one to bookmark.

banner