Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
I would like to shrink my lv_root from 9.54g to 8g safely. This is a SL6.3 vm running on SL6.3 base box. I tried "single" from grub and booted the box but lv_root gets mounted automatically so I didn't run any disk related commands to prevent loss of data.
This is my current disk layout:
[root@outsider1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
lv_root vg_outsider1 -wi-ao-- 9.54g
lv_swap vg_outsider1 -wi-ao-- 1.97g
[root@outsider1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/vda2 vg_outsider1 lvm2 a-- 11.51g 0
[root@outsider1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_outsider1-lv_root
9.4G 2.3G 6.7G 26% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 485M 33M 427M 8% /boot
[root@outsider1 ~]#
I found a way to boot the VM using resuce mode and was successful with shrinking the size of lv_root safely following the steps provided by Kustom42 member. Thanks.
><rescue> resize2fs -f /dev/mapper/vg_outsider1-lv_root 8G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_outsider1-lv_root to 2097152 (4k) blocks.
The filesystem on /dev/mapper/vg_outsider1-lv_root is now 2097152 blocks long.
><rescue> lvreduce -L 8G /dev/mapper/vg_outsider1-lv_root
WARNING: Reducing active logical volume to 8.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_root? [y/n]: y
Reducing logical volume lv_root to 8.00 GiB
Logical volume lv_root successfully resized
><rescue> exit
exit
virt-rescue: Syncing the disk now before exiting ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.