Unable to e2fsck -f /dev/mapper/rhel-home to reduce the volume

Latest response

Hello.
I have an RHEL7 Virtual Machine (hosted by the VM Ware ESXi hypervisor). It has 1 TB drive with the LVM onboard configured ~2 years ago while installing the OS.
The lvs tool output shows how the physical volume has been divided into the logical volumes.

lvs
  LV   VG   Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home rhel -wi-a----- <965,12g                                                    
  root rhel -wi-ao----   50,00g                                                    
  swap rhel -wi-ao----   <7,88g

I need to resize (extend) the root partition (the logical volume in the VLM) because I slowly run out of space there. To achieve that I have to reduce the size of /home volume which is quite large and there is lots of free room there.

The procedure of reducing the volume says that first I have to unmount the /dev/mapper/rhel-home from /home.

umount -v /home
umount: /home (/dev/mapper/rhel-home) unmounted

Then I have to fsck the unmounted volume:

e2fsck -ff /dev/mapper/rhel-home
e2fsck 1.42.9 (28-Dec-2013)
**e2fsck_open2: Bad magic number in super-block**
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/mapper/rhel-home

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

but - as you can see - I get an error message.

So I use another tool which simulates creating a filesystem on the logical volume giving me some hints about the location of the backup superblocks.

mkfs.ext4 -n /dev/mapper/rhel-home 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS Type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
63250432 i-nodes, 252999680 blocks
12649984 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2401239040
7721 block groups
32768 blocks per group, 32768 fragments per group
8192 i-nodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000, 214990848

So I use the following command to use the backup superblock but get another error message. I get the same using each number given by the previous one 32768, 98304 and so forth.

e2fsck -b 71663616 -B 4096 /dev/mapper/rhel-home
e2fsck 1.42.9 (28-Dec-2013)
e2fsck: Bad magic number in super-block while trying to open /dev/mapper/rhel-home

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

Can you, please, help me shrinking the rhel-home volume? Let me add that once mounted everything works great. I can see and list and cat all the files stored in it.

Responses

As you can mount /dev/mapper/rhel-home successfully, it seems to me the most likely explanation is that it isn't an ext file system. If you mount it then run the mount command, the relevant line should tell you what the file system is. Alternatively you could run file -sL /dev/mapper/rhel-home which should also tell you what it is.

Hello, Michael. Thanks for your time getting familiar with my issue. You are absolutely right! I have made a fool of myself. I am embarrassed. I do not know why I have not figured it out myself. On the other hand, it is a lesson that once you involve in something and cannot manage resolving it invite somebody else who is not emotionally involved and has neutral critical outlook and is able to ask appropriate questions. Just like you, Michael. Thanks a lot, really. As you can see below, the filesystem on /home volume is xfs instead of ext (4, in fact) as I assumed.

/dev/mapper/rhel-home on /home type xfs (rw,relatime,attr2,inode64,noquota)

Thanks again, Michael, for opening my eyes. Now I have to schedule another maintenance window to proceed with resizing my partitions in the LVM.

How do I mark the thread resolved?