3
1
I did following under the root
login (shrinking /home
, expanding /var
):
umount /home lvresize -L-7G /dev/mapper/myvg-home
it was warning:
WARNING: Reducing active logical volume to 28.89 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
I thought it is usual warning and accepted
Then I done:
> lvresize -L+7G /dev/mapper/myvg-var
It was successfully done:
Extending logical volume var to 9.79 GiB
Logical volume var successfully resized
But as I saw the /var
didn't expanded if looking with df -h
. I thought the reboot will solve the problem.
Then I tried to mount the home partition back:
> mount /home
And I got an error:
mount: wrong fs type, bad option, bad superblock on /dev/mapper/myvg-home,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Then I rebooted the machine. Afterwards I got:
/dev/sda2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Welcome to emergency mode. Use "systemctl default" or ^D to activate default
mode.
Give root password for maintenance
(or type Control-D to continue):
So I entered the maintenance console and ran:
> fsck /dev/mapper/myvg-home
But after some questions about errors and whether I would like to abort the operations I got a new error:
fsck.ext4: Can't read an block bitmap while retrying to read bitmaps for /dev/mapper/myvg-home
e2fsck: aborted
So I cannot get the system running. What is the problem and what did I wrong when tried to resize the lvm partitions? It is just unmount, resize and mount back again, isn't it?
Is it possible to recover the partition or at least to create a new and get the system running back, or does it require some special operations to create a new home partition?
You need to use lvresize -r to resize the file system at same time. Basically you only modified LV size but the file system still at old size. – Ask and Learn – 2015-11-17T23:05:36.960
1When you
lvresize
you're only resizing the virtual volume. The actual file system partition isn't affected. You still need to resize it withresize2fs
before the space shows up indf
. Similarly, you'll first want to shrink your partition before you shrink the volume the partition resides on. – Der Hochstapler – 2013-10-10T17:26:15.267so, is it possible to recover the
/home
with the files there? I recovered using thevgcfgrestore -f /etc/lvm/archive/my-vg_00002-692643462.vg my-vg
, solvs
shows now the previous partition table. But if I try to mounthome
I get the same error message:mount: wrong fs type, ...
. – static – 2013-10-10T17:31:20.147First shrink the file system, then shrink the lvm. For expasion, expand the lvm first, then expand the file system. – RainDoctor – 2014-02-19T19:58:51.157