Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #229685 > unrolled thread

Migrating LVM volumes to a new machine

Started byMark Fletcher <mark27q1@gmail.com>
First post2020-12-12 00:50 +0100
Last post2020-12-12 13:40 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Migrating LVM volumes to a new machine Mark Fletcher <mark27q1@gmail.com> - 2020-12-12 00:50 +0100
    Re: Migrating LVM volumes to a new machine Michael Stone <mstone@debian.org> - 2020-12-12 01:00 +0100
      Re: Migrating LVM volumes to a new machine Mark Fletcher <mark27q1@gmail.com> - 2020-12-12 13:00 +0100
        Re: Migrating LVM volumes to a new machine Andy Smith <andy@strugglers.net> - 2020-12-12 13:40 +0100

#229685 — Migrating LVM volumes to a new machine

FromMark Fletcher <mark27q1@gmail.com>
Date2020-12-12 00:50 +0100
SubjectMigrating LVM volumes to a new machine
Message-ID<Bl0kF-2Cv-1@gated-at.bofh.it>
Hello

I would like to understand how to move a LVM VG from one machine to 
another, when the disk to be moved contains filesystems key to the 
source system. I have read section 13.6 of the LVM HOWTO which talks 
about moving VGs. However the context of my situation is I am 
cannibalising an old machine and moving the VG that contains the LVs 
mounted on /, swap and /home of the source machine. That, apart from the 
non-LVM /boot partition, is all that is on this SSD.

The disk will not be the primary disk on the new machine, and the new 
machine's /, swap and /home will be elsewhere, but I will want to be 
able to access the current contents of the disk from the old machine on 
the new machine for a period of time before I decide to wipe it. I feel 
like I can't follow the instructions in the HOWTO because it wants me to 
unmount the file systems, export the LVs and so on, on the old machine 
before moving the disk, and I don't see how I can do that on a system 
that is expecting to use those file systems to operate.

I thought of booting a live system from a USB stick, so the affected LVs 
aren't mounted or in use, but then I'll face the problem of how to get 
the live system to be aware of the LVM setup existing on the SSD.

I guess the bottom line is I am missing some understanding of how LVM 
works in detail, and in particular how a machine that didn't create a 
particular VG and its contents can nonetheless be made to recognise it. 
Can anyone fill me in?

Thanks 

Mark

[toc] | [next] | [standalone]


#229686

FromMichael Stone <mstone@debian.org>
Date2020-12-12 01:00 +0100
Message-ID<Bl0ul-2Gj-3@gated-at.bofh.it>
In reply to#229685
On Fri, Dec 11, 2020 at 11:46:46PM +0000, Mark Fletcher wrote:
>I would like to understand how to move a LVM VG from one machine to
>another, when the disk to be moved contains filesystems key to the
>source system. I have read section 13.6 of the LVM HOWTO which talks
>about moving VGs.
...
>I feel
>like I can't follow the instructions in the HOWTO because it wants me to
>unmount the file systems, export the LVs and so on, on the old machine
>before moving the disk, and I don't see how I can do that on a system
>that is expecting to use those file systems to operate.

you must have missed:
"vgexport/vgimport is not necessary to move drives from one system to 
another. It is an administrative policy tool to prevent access to 
volumes in the time it takes to move them."

Just move the disk and the lvm stuff will show up like normal. The only 
potential gotcha is if you used the same volume group names on both 
systems, then that would need to be resolved (by renaming one of them)

[toc] | [prev] | [next] | [standalone]


#229694

FromMark Fletcher <mark27q1@gmail.com>
Date2020-12-12 13:00 +0100
Message-ID<BlbJ8-19L-5@gated-at.bofh.it>
In reply to#229686
On Fri, Dec 11, 2020 at 06:53:59PM -0500, Michael Stone wrote:
> On Fri, Dec 11, 2020 at 11:46:46PM +0000, Mark Fletcher wrote:
> > I feel
> > like I can't follow the instructions in the HOWTO because it wants me to
> > unmount the file systems, export the LVs and so on, on the old machine
> > before moving the disk, and I don't see how I can do that on a system
> > that is expecting to use those file systems to operate.
> 
> you must have missed:
> "vgexport/vgimport is not necessary to move drives from one system to
> another. It is an administrative policy tool to prevent access to volumes in
> the time it takes to move them."

Yeah... didn't miss that, but thought "that can't mean what it appears 
to mean, because if it did the whole article would be contracticting 
itself". So I guess "failed to understand" would be closer to the truth 
than "missed".

> 
> Just move the disk and the lvm stuff will show up like normal. The only
> potential gotcha is if you used the same volume group names on both systems,
> then that would need to be resolved (by renaming one of them)
> 

Oh. Good. Thanks! Yes I had considered that different VG names would be 
needed. I just let the installer do its thing with the naming last time, 
guess when I install this time on the new machine I will intervene.

That generates a followup question, out of curiosity. Presumably for 
that to work, all the info needed for the computer to learn about the VG 
at boot must be stored on the PV. What happens when there is more than 
one PV for a VG? Is the info stored on all of them, or just one?

Thanks

Mark

[toc] | [prev] | [next] | [standalone]


#229696

FromAndy Smith <andy@strugglers.net>
Date2020-12-12 13:40 +0100
Message-ID<BlclP-1BT-7@gated-at.bofh.it>
In reply to#229694
Hello,

On Sat, Dec 12, 2020 at 11:51:17AM +0000, Mark Fletcher wrote:
> That generates a followup question, out of curiosity. Presumably for 
> that to work, all the info needed for the computer to learn about the VG 
> at boot must be stored on the PV. What happens when there is more than 
> one PV for a VG? Is the info stored on all of them, or just one?

All of them.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/lvm_metadata

    "The configuration details of a volume group are referred to as
    the metadata. By default, an identical copy of the metadata is
    maintained in every metadata area in every physical volume
    within the volume group."

Have a read of it with:

# vgcfgbackup -f config.txt vgname

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web