2

Is there a way to perform a safe reduce in rootlv at rescue mode? Most of the internet's explanations tells, basically, that it can be done using the following steps sequence:

vgchange; fsck; resize2fs; lvreduce; reboot

I tried it a several times; but all I get when system pass through POST is the same error:

FATAL: INT18: BOOT FAILURE

Is that a way to do that safely?

  • Well, for one thing, use `lvreduce -r`, that avoids the risk of accidentally passing different sizes to `resize2fs` and `lvreduce`. Other than that, how are you booting this system? Odd you'd get a POST error... – derobert May 17 '15 at 05:49
  • @derobert, I reboot the virtual machine where I'm testing the steps, and then I get the mencioned error. – Roger Príncipe May 17 '15 at 05:59
  • To be clear, you're resizing a logical volume inside the VM, not outside the VM, correct? That is, not the backing device storing the entire VM image? – derobert May 17 '15 at 06:01
  • @derobert, exactly, I'm trying to reduce rootlv of a system installed in a virtualbox VM, a lab; NOT THE DISK COUNTAINING the VM's files. – Roger Príncipe May 17 '15 at 06:11
  • Ok, those steps would work on a KVM/Debian setup, at least if done from the initramfs (can't resize a mounted partition). I'm pretty sure they'd work with KVM/CentOS as well, though I haven't done that. I'd guess it's something different with the way VirtualBox is booting from the image. I suggest editing the details from these comments in, and hopefully someone who has dealt with CentOS on VirtualBox will stop by. – derobert May 17 '15 at 06:21
  • Please also give the full commands you're running, so someone can check for mistakes in them. – derobert May 17 '15 at 06:22
  • @dagobert, I figured out what I was doing wrong! I'll explain on the answer. Thanks for helping! – Roger Príncipe May 18 '15 at 15:28

1 Answers1

0

The steps I was doing were right at all. The problem was the way I was booting my system. BIOS found CentOS media, then installation menu has been shown to me. I was trying to boot choosing option "boot from hard drive" and after that I have received the error described before.

I repeated the steps again, but from this time I ejected CentOS' media before reboot. Bingo! It worked very well.

So, for help another person that eventually needs to reduce rootlv, here's howto:

  1. Boot from a CentOS media (option rescue mode. Don't mount your system when asked by the wizard);
  2. Activate rootvg (vgchange -ay rootvg. In case of you don't know vg's name, type vgs command)
  3. Run fsck on rootlv (for example: fsck -f /dev/mapper/rootvg-rootlv. In case of you don't know lv's name, type lvs command)
  4. Run resize2fs /dev/mapper/rootvg-rootlv 10G (taking on the size you'd like your LV to stay — 10 GB, for example, when you reduce 15 GB to 10 GB)
  5. Run lvreduce -L 10 GB /dev/mapper/rootvg-rootlv (the step 4 can be skipped if you use -r parameter here)
  6. Reboot the machine.
Anthon
  • 78,313
  • 42
  • 165
  • 222