0

I was attempting to reallocate unused disk space (1.2Tb) from /dev/mapper/centos-home to /dev/centos/root using the steps in How to move disk space from centos-home to centos-root.

After running...

$ umount /dev/mapper/centos-home
$ lvreduce -L 1200G /dev/mapper/centos-home

I'm getting a "can't read superblock" error when i try to remount the drive.

$ mount /dev/mapper/centos-home
mount: /dev/mapper/centos-home: can't read superblock

Before starting, I double-checked to make sure there w enough free (physical space) before running the 'lvreduce' command (there was 2Tb free) - but assume my error was not running a command to first shrink the file system as suggested in LVM logical volume partition corrupted after lvreduce, but also read that this can't be done on XFS systems pr have been unable to locate the specifics.

I tried to recover using,

$ xfs_repair /dev/mapper/centos-home 

but the result said

Sorry, could not find valid secondary superblock; Exiting now.

I also tried to restore the size of the LV

$ lvextend -L 1200G /dev/mapper/centos-home

with the result,

New size (307200 extents) matches existing size (307200 extents)

but got the same superblock read error when trying to $ mount the drive.

I'm not sure how deep of a hole I have dug for myself at this point, so here's my question.

What's the best way to recover from this? Or, if I can't recover and mount the damaged drive, do I just delete it and create a new one with the same name? And is this even possible, i.e. do I need to reinstall CentOS? I didn't back up this drive as I haven't been using it. I used the PLESK backup tool so could restore that way, but assume this only works on the /dev/centos/root drive so wouldn't apply here?

I have 4 physical disks set up as RAID5. The other drives and applications are running fine (PLESK lives on /dev/centos/root) and I don't want to damage them.

I'd also like to complete the original task of growing /dev/centos/root.

Here's where things are now....

$ pvscan
  PV /dev/sda3   VG centos          lvm2 [2.04 TiB / 838.63 GiB free]
  Total: 1 [2.04 TiB] / in use: 1 [2.04 TiB] / in no VG: 0 [0   ]

$ vgscan
  Reading volume groups from cache.
  Found volume group "centos" using metadata type lvm2

$ lvscan
  ACTIVE            '/dev/centos/swap' [4.00 GiB] inherit
  ACTIVE            '/dev/centos/home' [1.17 TiB] inherit
  ACTIVE            '/dev/centos/root' [50.00 GiB] inherit


$ pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               centos
  PV Size               2.04 TiB / not usable 0
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              535714
  Free PE               214690
  Allocated PE          321024
  PV UUID               qISA9P-0jFe-gk9I-5uuL-OODW-N3af-OkfJlB

$ vgdisplay
  --- Volume group ---
  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.04 TiB
  PE Size               4.00 MiB
  Total PE              535714
  Alloc PE / Size       321024 / 1.22 TiB
  Free  PE / Size       214690 / 838.63 GiB
  VG UUID               zzLRUZ-96Vd-5NGr-YsCl-PJ0l-O8Sy-07Dbqu


$ lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                Dxqf6A-Jtyp-Qdhx-1C0u-CS40-L95c-qF4tRU
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2016-12-20 09:00:45 -0500
  LV Status              available
  # open                 2
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                9QYG2p-0Srl-AluZ-qsBE-wCQ4-BXyN-0hmTp3
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2016-12-20 09:00:46 -0500
  LV Status              available
  # open                 0
  LV Size                1.17 TiB
  Current LE             307200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                WrqVSs-EkZI-WD7W-AfsL-2PFX-iZLy-8TPjZr
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2016-12-20 09:01:40 -0500
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  • I hope I didn't mangle something while reformatting the text using Markdown markup. Steve, you may want to double-check just to be sure. – a CVn Apr 21 '17 at 20:28
  • stop making changes NOW. You need to roll back the LV with its archive file. – Spooler Apr 21 '17 at 20:44
  • Thankfully, this is answered here: serverfault.com/a/223400/344497 – Spooler Apr 21 '17 at 20:48
0

SmallLoanOF1M, thanks for the suggestion. Because in my case i didn't need to recover the data on the /home logical volume (i appreciate this is an exception for most), i followed the instructions here and simply removed it using the $ lvremove command.

$lvremove -v /dev/centos/home

Which returned the remaining free space to the volume group.

I then used the $lvextend to extend the /root lv

$lvextend -L +900G /dev/centos/root

And

$xfs_growfs /dev/centos/root

to extend the file system in the now larger LV. Next time i install centos7 for a plesk application, i'll be sure to allocate more than 50G to /root, which is the default setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.