Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
moving root to lvm2 [solved]
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
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 634

PostPosted: Mon Jul 15, 2013 11:39 pm    Post subject: moving root to lvm2 [solved] Reply with quote

I already have a system installed with genkernel kernel on /boot and several lvm partitions:

Code:
# df
Filesystem                1K-blocks     Used Available Use% Mounted on
rootfs                     16512864   507944  15166116   4% /
udev                          10240        8     10232   1% /dev
/dev/md127                 16512864   507944  15166116   4% /
/dev/mapper/vg1-usr        10321208  4771640   5025280  49% /usr
tmpfs                       4089636     1164   4088472   1% /run
shm                         4089636        0   4089636   0% /dev/shm
cgroup_root                   10240        0     10240   0% /sys/fs/cgroup
/dev/mapper/vg1-home        8256952  1335232   6502292  18% /home
/dev/mapper/vg1-opt         6192704   371916   5506216   7% /opt
/dev/mapper/vg1-tmp         4128448   139272   3779464   4% /tmp
/dev/mapper/vg1-var         8256952   374816   7462708   5% /var
/dev/mapper/vg1-portage     6192704   939980   4938152  16% /usr/portage
/dev/mapper/vg1-vartmp      8256952  1172032   6665492  15% /var/tmp
/dev/mapper/vg1-distfiles  16513960  2555944  13119156  17% /usr/portage/distfiles


I want to move the '/' filesystem to the vg1 lvm group because root is currently a raid on a sata interface that seems a little flaky.

Here is my grub.conf:

Code:
default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.5.7-gentoo root=/dev/ram0 domdadm dolvm real_root=/dev/md127 rootfstype=ext4
initrd /boot/initramfs-genkernel-x86_64-3.5.7-gentoo


Can anyone give me some pointers on moving the root partition to the vg1 group? Should it work with the kernel and initrd I have already created with genkernel?
I think I need to use something like lvm2root=/dev/mapper/vg1-root", but I have never done this before.

Thanks


Last edited by russK on Thu Mar 27, 2014 9:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Jul 16, 2013 6:51 pm    Post subject: Reply with quote

russK,

I've never used genkernel for this but
Code:
real_root=/dev/mapper/vg1-root
should work if the genkernel initramfs has all the right bits in.
Its painless to test.

Boot with a liveCD, copy over your root to its new home and edit /etc/fstab to reflect the new root.
You may want to change the hostname in the new root to save your sanity later too.

Keep the existing boot stanza, so you can boot the old root.
Code:
title Gentoo Linux
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.5.7-gentoo root=/dev/ram0 domdadm dolvm real_root=/dev/md127 rootfstype=ext4
initrd /boot/initramfs-genkernel-x86_64-3.5.7-gentoo


Add a new boot stanza after the above
Code:
title Gentoo Linux Root on LVM
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.5.7-gentoo root=/dev/ram0 domdadm dolvm real_root=/dev/mapper/vg1-root rootfstype=ext4
initrd /boot/initramfs-genkernel-x86_64-3.5.7-gentoo


Reboot to test. Your old root will be the default - choose the Gentoo Linux Root on LVM option in the grub menu.
If it works, you are done.

I hand roll my initrds, so I know how they work and whats in them
_________________
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
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 634

PostPosted: Thu Mar 27, 2014 9:48 pm    Post subject: moving root to lvm2 [solved] Reply with quote

Should have replied a long time ago, this method worked.
Many thanks NeddySeagoon.
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