0

I had some old hard disks with lvm, without partitions. I.e. the whole disk were formatted as LVM physical volumes, and they didn't contain any partition tables.

I've backed them up, with sector-level copy (dd) into lvm logical volumes.

The result is that now some of my logical volumes are also physical volumes, containing other logical volumes on them.

LVM works well, it detects them and I could use them (being backups, I practically don't use them, but I still need them).

I find this multi-level lvm structure a little bit sub-optimal, so I want to move them "out" of a layer, and convert them into top-level volumes.

Of course I could do this by creating top-level LVs with the same size and name, and copy the second-level LVs with dd into them. But I would like to prefer to do it on an "LVM way", i.e. purely with lvm commands.

As far I know, there are (not very easy) ways to combine LVM VGs, but I fear maybe they would create lockups in such an lvm-over-lvm constellation.

Is it possible to do it, and how?

peterh
  • 9,731
  • As the last sentence shows: also a "no" or "probably no" or "maybe, but impractical" answers is acceptable. – peterh Sep 19 '17 at 11:22
  • There are methods to copy LVs across VGs. See, for example https://unix.stackexchange.com/a/374665/4671. It does look a bit hair raising at first glance, I admit. For a copy, as far as I know, you need to use my method (which is obviously safer). For a move, you can use pvmove. Do a search for "copying logical volumes across volume groups". This gives me hits for similar questions in AU, SU, and the already cited U&L one. – Faheem Mitha Sep 19 '17 at 12:54

1 Answers1

0

Although it could be made possible, the standard tool to merge volume groups doesn't work, but it gives an error message. It has probably a lock -protection reason (and that it is a rare scenario). Considering it, some workaround to find a "more beautiful", "lvm way", was inpractical.

I solved it with the workaround (creating LVs with the same name and size, and then block-copy the content into them).

Instead dd, I used the far quicker buffer tool (it was roughly 2.5 times faster, having a multi-process, event-oriented, well-buffered internal mechanism).

peterh
  • 9,731