Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] move LVM to new device or new install?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dystopic_utopia
n00b
n00b


Joined: 17 Sep 2019
Posts: 11

PostPosted: Tue Jan 28, 2020 1:30 pm    Post subject: [Solved] move LVM to new device or new install? Reply with quote

So the laptop that I had installed Gentoo on this previous August, started having hardware issues (it had belong to a child before). I have since got a replacement device, and of course I want to have Gentoo running on it, though dual booting with Windows.

My original setup is based on Sakaki's EFI guide. I was wondering if it would be better to just migrate my LVM from the original device, to a newly encrypted LUKS partition on the new device and configure kernel/portage/etc accordingly, or would a new install be a better option? Thank you for reading, and in advance for any help.


Last edited by dystopic_utopia on Wed Jan 29, 2020 12:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45383
Location: 56N 3W

PostPosted: Tue Jan 28, 2020 2:11 pm    Post subject: Reply with quote

dystopic_utopia,

If the CPUs are different, you may need to rebuild enough of the existing install to boot on both systems, do the migration, then rebuild it again in its new home.
It depends on the CPU differences.

If one is AMD and the other is Intel, the rebuild will be required. If the CPU instruction set on the old system is a subset of that on the new system, it will just work, other than the kernel.
Once in its new home, it will be suboptimal but that will be fixed in your normal update cycle, so no hurry.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15294

PostPosted: Wed Jan 29, 2020 2:37 am    Post subject: Reply with quote

If you decide to migrate the existing install, take care to migrate it at the file level, not the block layer. That means:
  • Partition the new drive.
  • Create new LUKS container(s) on the new partition(s).
  • Create new LVM PVs, LVM VGs, and LVM LVs according to how you want to lay out your data.
  • Create filesystems in the new LVs.
  • Mount those filesystems, then copy your data from the old drive to the new drive. You can copy over the network or attach both drives to the same system, at your preference. When you perform this copy, be careful to preserve as much file metadata as possible. In particular, you want to preserve xattrs, permissions (including suid bits), and mtimes.
You may want to practice migrating a few small directories, like /bin, to verify that your copy does the right thing.

Since this is a laptop, you may want to be able to hibernate it. If so, remember to allocate an appropriately sized swap device. If you want swap to be encrypted (most hibernate users want this), remember to put the swap device inside a LUKS container.
Back to top
View user's profile Send private message
dystopic_utopia
n00b
n00b


Joined: 17 Sep 2019
Posts: 11

PostPosted: Wed Jan 29, 2020 12:51 pm    Post subject: Reply with quote

Thanks for your replies! It is going to take some preparation before I actually begin the process, but this has definitely added to the information I will need when the time comes. It is good to know that I will at least be able to pick up where I left off, in a sense.
Back to top
View user's profile Send private message
sdauth
Tux's lil' helper
Tux's lil' helper


Joined: 19 Sep 2018
Posts: 134
Location: Frankreich

PostPosted: Wed Jan 29, 2020 1:30 pm    Post subject: Reply with quote

Hu wrote:
In particular, you want to preserve xattrs, permissions (including suid bits), and mtimes.

I used rsync yesterday to clone a lvm logical volume to a new logical volume.
The command I used was : rsync -avhP --delete old_lv/ /mnt/new_lv/

The rsync man states that the -a switch (archive) does the following :
Code:
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)


So no hard links, acl or xattrs. Still, my new root is running fine. Will I run into troubles later because of missing -X switch ? :?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15294

PostPosted: Thu Jan 30, 2020 2:09 am    Post subject: Reply with quote

You might. I would worry about both hard links and xattrs. Some programs may have hard linked files together, and expect that writing to one of those files writes to all of them, since the names are (or were, until you broke the hard link) backed by the same inode. Xattrs can be used, among other things, for capabilities.
Back to top
View user's profile Send private message
sdauth
Tux's lil' helper
Tux's lil' helper


Joined: 19 Sep 2018
Posts: 134
Location: Frankreich

PostPosted: Fri Jan 31, 2020 10:59 am    Post subject: Reply with quote

@Hu
Well, the good thing is that I'm still using the original lvm / for the moment so no worries. I will be able to run rsync with new options. Thanks for the information Hu.
Now, I realize there should be a way to clone that lvm volume to a new one with lvm tools but it gave me headaches last time I "read" the lvm manual so I prefered to use good old rsync. :lol:
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15294

PostPosted: Sat Feb 01, 2020 1:42 am    Post subject: Reply with quote

LVM is a block layer abstraction, so even if you found an invocation that would do so, it would likely copy all blocks, including free blocks, to the destination. That gives you perfect precision (assuming the source is remounted read-only for the duration), but costs extra time copying empty blocks, and tricks SSDs into marking more space as used than is really the case. Copying at the file layer, by using rsync or similar, is usually a better choice.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum