I want to detach a PV from a VG, but with preserving the data on it, with the possibility of a re-attach in the future.

The LVs are completely separated on it (no LV has LEs on both the PV to separate, and on the rest).

Doing this would be easy with losing the data on the PV (pvmove, vgreduce), but this would be the opposite what I want.

Is it somehow possible?

  • Detach with vgsplit, attach with vgmerge. – frostschutz Oct 5 '18 at 10:54
  • @frostschutz Thank you very much! Can it be done in hot? – peterh Oct 5 '18 at 10:58
  • @frostschutz I checked it. The main VG can remain active (including its LVs), but the LVs on the PV to split has to be deactivated with lvchange -an. If you create an answer from it, it will deserve an upvote + accept. – peterh Oct 5 '18 at 11:32
  • @frostschutz Sad that you didn't write that answer, maybe it is because der Winter kommt und you have too much to do :-) – peterh Oct 6 '18 at 17:53

As @frostschutz explained, in this case the vgsplit tool can be used to split a PV from a VG, and convert it to another, single-PV VG:

vgsplit yourvg newvgname /dev/sdx

It removes the PV /dev/sdx from the VG yourvg, and converts it to a new, single-PV VG named newvgname.

For vgsplit, all the LVs on the PV /dev/sdx should be offline, what can be reached by the command vgchange -an /dev/yourvg/lvname aften unmounting them.

Later the VGs can be re-joined by the vgmerge command.

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.