LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I migrate an existing standard install of debian with grub to LVM (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-migrate-an-existing-standard-install-of-debian-with-grub-to-lvm-4175524328/)

slacker_ 11-04-2014 01:26 PM

How do I migrate an existing standard install of debian with grub to LVM
 
Just to clarify something ahead of time, I'm running a liveusb of mint 17 to do all this, that's just what I had lying around to work with.

More clarification, I am stuck at getting grub to work. Everything is back in place, but I can't get grub to work beyond showing the menu. When I hit enter on the selection for my drive, i get this.

I've already tried the following links, and they didn't help me:
http://ubuntuforums.org/showthread.php?t=1347375
http://manpages.ubuntu.com/manpages/...te-grub.8.html
https://wiki.archlinux.org/index.php/GRUB#LVM
http://wiki.gentoo.org/wiki/LVM[/QUOTE]

I had disk orginally set up with separate /boot, /, and /home partitions for debian, with another / for mint which would share the /boot and /home partitions. I've backed up everything to an external hdd, wiped my drive and made an LVM partiton, and created the volume group, and subsequent logical volumes, and rsync'd everything back. I then chrooted in to the debian root (with everything mounted of course) and that's where any and all guides I could find failed me.

I tried all the typical grub-install things one would do to reinstall from chroot, but it didn't work. I was able to run "grub-install --recheck /dev/sda" and "update-grub" one of which updated my grub.cfg to include "insmod lvm" and the proper lv labels where required. So I edited my fstab to include the proper uuids for each lv. It booted to the correct grub menu and I was thrilled, but when I selected the firat option it didn't go thru (I'll update with pictures of error). I can't find anything anywhere to help me with this, so could anyone here tell me what is the proper way to install grub on an lvm and get it running correctly? Please and thanks!

Forgot to include my vg and lv setup. See below:
Code:

vgdisplay
  --- Volume group ---
  VG Name              vgfirstdisk
  System ID           
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  10
  VG Access            read/write
  VG Status            resizable
  MAX LV                0
  Cur LV                5
  Open LV              1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size              149.05 GiB
  PE Size              4.00 MiB
  Total PE              38156
  Alloc PE / Size      38156 / 149.05 GiB
  Free  PE / Size      0 / 0 
  VG UUID              Wujkgq-nigA-oeim-Zk37-a35J-lRbP-8pyWeq

lvdisplay
  --- Logical volume ---
  LV Path                /dev/vgfirstdisk/lvboot
  LV Name                lvboot
  VG Name                vgfirstdisk
  LV UUID                tJrNGc-R70A-Bb07-V5AR-VnyD-QwBi-32Dgar
  LV Write Access        read/write
  LV Creation host, time mint, 2014-11-03 04:57:13 +0000
  LV Status              available
  # open                0
  LV Size                256.00 MiB
  Current LE            64
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          252:0
 
  --- Logical volume ---
  LV Path                /dev/vgfirstdisk/lvdebroot
  LV Name                lvdebroot
  VG Name                vgfirstdisk
  LV UUID                fFu87n-nwzM-B0yK-Zg0j-ZLhB-2fmd-6PynwW
  LV Write Access        read/write
  LV Creation host, time mint, 2014-11-03 05:00:15 +0000
  LV Status              available
  # open                1
  LV Size                15.00 GiB
  Current LE            3840
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          252:1
 
  --- Logical volume ---
  LV Path                /dev/vgfirstdisk/lvmintroot
  LV Name                lvmintroot
  VG Name                vgfirstdisk
  LV UUID                YhoiOs-jtHd-ngUf-7eCv-LYsC-hfSU-Mokr7q
  LV Write Access        read/write
  LV Creation host, time mint, 2014-11-03 05:00:25 +0000
  LV Status              available
  # open                0
  LV Size                15.00 GiB
  Current LE            3840
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          252:2
 
  --- Logical volume ---
  LV Path                /dev/vgfirstdisk/lvswap
  LV Name                lvswap
  VG Name                vgfirstdisk
  LV UUID                Z0FOVv-GR2g-3OE6-ayWJ-jfr0-ujPw-DCFMjb
  LV Write Access        read/write
  LV Creation host, time mint, 2014-11-03 05:03:07 +0000
  LV Status              available
  # open                0
  LV Size                2.00 GiB
  Current LE            512
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          252:3
 
  --- Logical volume ---
  LV Path                /dev/vgfirstdisk/lvhome
  LV Name                lvhome
  VG Name                vgfirstdisk
  LV UUID                FErvq2-u8Pt-itBq-BNni-an3n-W1BA-rKJqeH
  LV Write Access        read/write
  LV Creation host, time mint, 2014-11-03 05:03:42 +0000
  LV Status              available
  # open                0
  LV Size                116.80 GiB
  Current LE            29900
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          252:4


jefro 11-04-2014 05:03 PM

"migrate an existing standard install of debian to LVM"

Copy or clone off and then create as you like and clone or copy back is a usual way.

It may be possible to do the old shuffle trick where you create some small lvm and then move files a few at a time and then resize and move more and eventually it's all moved and you delete original.

I don't know of a way to create in place. Might be.

slacker_ 11-04-2014 07:43 PM

Ok, it's migrated, but the issue is with getting grub working with this too. I can't figure out how to get grub to update with this new layout. That's my roadblock.

jefro 11-04-2014 08:36 PM

http://ubuntuforums.org/showthread.php?t=1347375

http://manpages.ubuntu.com/manpages/...te-grub.8.html may be most easy way. This assumes you have a current enough grub that has support for all the devices and file systems.

Some tips in here. https://wiki.archlinux.org/index.php/GRUB#LVM


Better see this too.
http://wiki.gentoo.org/wiki/LVM

slacker_ 11-04-2014 10:54 PM

Quote:

Originally Posted by jefro (Post 5264678)
http://ubuntuforums.org/showthread.php?t=1347375

http://manpages.ubuntu.com/manpages/...te-grub.8.html may be most easy way. This assumes you have a current enough grub that has support for all the devices and file systems.

Some tips in here. https://wiki.archlinux.org/index.php/GRUB#LVM


Better see this too.
http://wiki.gentoo.org/wiki/LVM

I've been trying to use all that already. In order:

Ubuntu forum thread - there is no "grub" command for me to use.

Arch Wiki & update-grub - I used update-grub and it changed the entries to be what the arch wiki suggests, but it won't boot with that. As mentioned in OP, the grub menu is generated properly, but it can't or won't boot the entry.

Gentoo wiki - nothing in there about using lvm with grub.

slacker_ 11-05-2014 02:44 PM

I double checked that error message I get when I try to boot up one of the menu entries. It says that "/dev/mapper/vgfirstdisk-lvdebroot" doesn't exist, so I went and double checked and it surely does, pointing right at /dev/dm-1. For some reason this just isn't being seen by grub or something, so I'm going to try setting "set root='(vgfirstdisk-lvdebroot)'" and all similar entries directly to dm-1, or dm-0 for lvboot. Will update with results.

slacker_ 11-05-2014 03:48 PM

Turns out the issue wasn't grub at all. Or maybe it still is, I'm not sure. When it failed to find vgfirstdisk-lvdebroot it dropped me to an ash shell. From there I was able to look around the filesystem that was available to me. There was no entry in /dev for dm-*, no volume group, no logical volumes. Nothing showed up. Well, more specifically none of my lvm stuff showed up. So my guess is that (maybe, I'm probably wrong here) something with init isn't starting the way it should in order to pull up, recognize, and use the vg or lv that I have.

Any thoughts or suggestions would be more than welcome.

syg00 11-05-2014 04:13 PM

If you got to ash grub has done its job. Check the initrd/initramfs has all the necessary support.

slacker_ 11-05-2014 04:26 PM

Quote:

Originally Posted by syg00 (Post 5265192)
If you got to ash grub has done its job. Check the initrd/initramfs has all the necessary support.

That's a bit above my head right now. I've not delved this deep into messing with initrd/initramfs yet, so I'll need some guidance. I've been looking up initramfs lvm support, and update initramfs for lvm and other related terms but can't find anything similar to my situation. Any starting advice?

jefro 11-05-2014 07:03 PM

Oh, my. Sorry. I was of no help here at all.

syg00 11-05-2014 08:07 PM

Best would be to chroot into the LVM Debian, then simply run whatever Debian use to generate the initramfs. It should pull in all the required modules for the current environment, including LVM.
I'd reckon "update-initramfs -u" should update the current initramfs image, but I don't use Debian. this is the handbook for another option. They also have a wiki.

slacker_ 11-05-2014 09:15 PM

Ok, i was thinking that would be the command needed but didn't know enough about it. When i get home I'll update with results.

slacker_ 11-06-2014 02:54 AM

No go. I prepared the chroot as follows:

Code:

mount /dev/vgfirstdisk/lvdebroot /mnt
mount /dev/vgfirstdisk/lvboot /mnt/boot
mount /dev/vgfirstdisk/lvhome /mnt/home
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev

then I chroot in to /mnt and run the following (as per the deb handbook):

Code:

root@mint:/# dpkg-reconfigure linux-image-3.2.0-4-amd64
Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.2.0-4-amd64 /boot/vmlinuz-3.2
.0-4-amd64
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-4-amd64 /boot/
vmlinuz-3.2.0-4-amd64
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open modde
p file '/lib/modules/3.13.0-24-generic/modules.dep.bin'
intel-microcode: cpuid MSR kernel support missing
intel-microcode: disabling IUCODE_TOOL_SCANCPUS option
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-4-amd64 /boot/vmlinuz
-3.2.0-4-amd64
run-parts: executing /etc/kernel/postinst.d/zz-extlinux 3.2.0-4-amd64 /boot/vmli
nuz-3.2.0-4-amd64
P: Checking for EXTLINUX directory... found.
P: Writing config for /boot/vmlinuz-3.2.0-4-amd64...
grub-probe: error: cannot find a GRUB drive for /dev/sdc1.  Check your device.map.
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
P: Installing debian theme... done.
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
Found memtest86+ image: /memtest86+.bin
Found memtest86+ multiboot image: /memtest86+_multiboot.bin
grub-probe: error: cannot find a GRUB drive for /dev/sdc1.  Check your device.map.
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
ls: reading directory /var/lib/os-prober/mount: Input/output error
done

then reboot. Same result, lists the issues that it might be and drops to an ash shell.

Just to clarify, the mentions of the 3.13 kernel in the above code snippiet are just from an experiment I was running to build a kernel module for an external system. Has no affect on this at all as the kernel isn't actually setup to run on this system at all, and wasn't interferring with the system before anyway.

So I tried this:

Code:

root@mint:/# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/3.13.0-24-generic/modules.dep.bin'
intel-microcode: cpuid MSR kernel support missing
intel-microcode: disabling IUCODE_TOOL_SCANCPUS option

and reboot. Same result.

I don't know if this means anything, but I have my external plugged in this whole time too and it'll complain about I/O errors for /dev/sdc or something like that before dropping to the ash shell. I tried unplugging it, but it doesn't make a difference.

So, now that this avenue has been explored, what do I try next?

slacker_ 11-08-2014 01:27 PM

I'm thinking I either didn't do something right when updating the initrd, or something else needs updating. Any input would be greatly appreicated as I have hit a wall here and don't know where to go to continue.

slacker_ 11-10-2014 05:04 PM

UPDATE! I got something to actually boot. So I was trying to copy over my old system to this new LVM setup, then I was going to install linux mint. Well, I got it copied, but wouldn't boot and figured "Screwit, I'll install mint and see if it fixes anything" which it kinda did. I can boot mint from lvmintroot perfectly. The grub menu now looks nice and clean and has debian listed on lvdebroot. But for some reason debian still doesn't boot correctly. Several things just don't work right anymore. Slim won't start up, bash-completion was wonky so I had to reinstall that, and more. So this tells me that something wasn't copied correctly, or that further reconfiguring is required to get this to work. Problem now is, I don't know what to do next. Any ideas or guidance would be greatly appreciated as always.


All times are GMT -5. The time now is 10:00 PM.