0

I mirrored my filesystem onto 3 drives using LVM mirror.

I broke off one of it's legs, by simply unplugging an external drive, before upgrading Ubuntu to 19.10.

So I started the upgrade, but having that drive removed made the system unbootable! I had my grub on that external drive. After fixing the boot problem I finally got the system back, but the upgrade did not go smoothly. In order to fix MariaDB I now would like to gain access to my old my.cnf file located on that external hard drive

How would I temporarily mount that LVM mirror leg to gain access to that file?

sudo -i
lvmdiskscan
  /dev/loop0  [    <104.13 MiB] 
  /dev/loop1  [    <153.47 MiB] 
  /dev/sda1   [    <930.73 GiB] LVM physical volume
  /dev/loop3  [      42.80 MiB] 
  ...
  /dev/sdb1   [    <465.76 GiB] LVM physical volume
  ...
  /dev/sdc1   [    <222.23 GiB] LVM physical volume
  ...
  /dev/loop38 [      51.30 MiB] 
  0 disks
  36 partitions
  0 LVM physical volume whole disks
  3 LVM physical volumes

/dev/sdc1 is my external hard drive. So in order to mount it I did

mount /dev/sdc1 /mnt

but I am getting this error:

mount: /mnt: unknown filesystem type 'LVM2_member'.

How would I go about mounting it?

pvs
  PV         VG        Fmt  Attr PSize    PFree   
  /dev/sda1  ubuntu-vg lvm2 a--  <930.73g  704.08g
  /dev/sdb1  ubuntu-vg lvm2 a--  <465.76g  239.12g
  /dev/sdc1            lvm2 ---  <222.23g <222.23g
lvdisplay /dev/sdc1
  Volume group "sdc1" not found
  Cannot process volume group sdc1

the drive to mount:

drive to mount

0

The logical volume on that system is /dev/ubuntu-vg/root. Paging space at /dev/ubuntu-vg/swap would not have a file system.

There is no volume on /dev/sdc1. It has LVM2 metadata, but pvs does not show it in a VG, and it is 100% empty.

How exactly this happened depends on the commands used to create the mirror, and your recovery steps. It is possible to have a mirror log on a separate PV from the data. (Note that raid1 is different from mirror, see man lvmraid.) Or creating the mirror volume never used sdc1 as you assumed.

Recover or rebuild that file some other way.


A better way to take a backup is snapshots.

Create an LVM snapshot volume. Copy off it it to the external storage. Either mount the snapshot as a file system and copy files, or copy the snapshot as an image with dd.

  • I remember seeing it "work" during the building of the mirror. It took some time. What was it doing if not mirroring the data? – MeSo2 Nov 18 '19 at 5:48
  • Cannot tell without more details on how you created the mirror and how you recovered it. Possible that your recovery reduced sdc1 out of the volume group. – John Mahowald Nov 18 '19 at 15:11
  • At a given point I renamed the VG of the two internal drives, in the hope of not causing some conflict with the external drive. I did this having the external drive unplugged. Somehow the renaming caused the external drive to dump that original VG name all together. – MeSo2 Nov 18 '19 at 19:02
  • If what you say is true, I do not see how this happened. Start data recovery on a copy of the PV, bring in a professional if you do not know how. In parallel, evaluate how to rebuild any valuable files from nothing. – John Mahowald Nov 19 '19 at 7:54
  • I gave up on the idea of ever recovering that my.cnf file. It was easy to just replace it. But thank you for all the help. – MeSo2 Nov 20 '19 at 4:00

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.