1

System: Gentoo linux with Grub2.

I got new ssd drive, so I want to move root partition to this device. At moment I have these partitions:

/dev/sda1       2048      6143      4096     2M BIOS boot
/dev/sda2       6144    268287    262144   128M EFI System
/dev/sda3     268288   8388607   8120320   3.9G Linux filesystem
/dev/sda4    8388608 134217727 125829120    60G Linux filesystem
/dev/sda5  134217728 974676015 840458288 400.8G Linux filesystem

where sda2 is boot partition, sda3 - swap, sda4 - root, sda5 is lvm device.

New drive is fully managed by lvm. New root partition located at /dev/samsung-ssd/root. I've already changed /etc/fstab on new root.

I've read this answer https://unix.stackexchange.com/a/5318, but it suggests to move boot partition with root to new device, where I want to keep boot on old disk.

I tried to edit grub.conf and replace kernel boot option from root=/dev/sda4 to root=/dev/samsung-ssd/root, but got a kernel panic (failed to find root partition).

So my question is how to move root partition to new drive and keep boot partition on old?

g4s8
  • 438
  • 6
  • 18
  • You do not really need a separate /boot partition with newer kernels. It is far easier to manage that way. – Rui F Ribeiro Jan 18 '18 at 19:59
  • As Scyid said, you need to create a initramfs with support for LVM and also tell GRUB to include LVM support. See https://wiki.gentoo.org/wiki/LVM#Using_LVM_in_an_initramfs – Emmanuel Rosa Jan 19 '18 at 01:24

1 Answers1

3

I think, if it is gentoo than you should make your initramfs LVM "aware"…

So, first generate the initramfs with:

root# genkernel --lvm initramfs

Than add this to your grub configuration (/etc/default/grub):

GRUB_CMDLINE_LINUX="dolvm"

And update the grub (update-grub ? I'm not sure…).

Scyld de Fraud
  • 2,662
  • 16
  • 14
  • 1
    Thanks! It solved my problem. To update grub I've used `grub-mkconfig -o /boot/grub/grub.cfg` – g4s8 Jan 19 '18 at 12:50