Does anybody have a suggestion for how to move the root partition to a new drive and set up grub2 to boot on that drive? I seem to have no luck instructing grub-mkconfig what it is I want to do (e.g. chroot'int into my new root just confuses all the scripts).Background I am running Debian Squeeze on a headless low-power NAS. My current setup is / on sda0 and /boot on sde0 (a CF card): I needed the separate /boot because sd[a-d] need to do a delayed spin-up. Now I've found an old 2.5 IDE disk to use as / including /boot to allow me to spin all the big disks down. What I've tried Basically I wentmount -o rw /dev/sdf5 /mnt/newrootcp -ax / /mnt/newrootcp -ax /boot /mnt/newroot/bootThen I tried chroot /mnt/newrootupdate-grubBut that failed with grub asking if root was mounted.Then I did a half-hearted attempt at setting up /mnt/newroot/grub/grub.cfg to find the kernel image on sdf5, followed by a grub-install --root-directory=/mnt/newroot /dev/sdf. But this just landed me a grub rescue prompt when I tried booting from sdf.My backup plan is to just reinstall, so a bonus question (no checkmarks for this one): What do I have to do to get my lvm2 and mdadm config across? Is it all stored in the filesystems (and will it be automatically discovered), or do I need to take of it myself?Solution (thanks to Maciej Piechotka): As Maciej points out, I need to to a proper chroot for all the grub tools to work. For reference, this is how I did it:janus@nasguld:/mnt/newroot$ sudo cp -ax / /mnt/newrootjanus@nasguld:/mnt/newroot$ sudo cp -ax /boot /mnt/newrootAll the files are now copied (see here for a discussion of copy strategies). Fix the new etc/fstab to point to new root:janus@nasguld:/mnt/newroot$ diff -u etc/fstab.old  etc/fstab    -UUID=399b6a6d-c067-4caf-bb3e-85317d66cf46 /     ext3 errors=remount-ro         0 1    -UUID=b394b614-a977-4860-bbd5-7862d2b7e02a /boot ext3 defaults                  0 2    +UUID=b9d62595-e95c-45b1-8a46-2c0b37fcf153 /     ext3 noatime,errors=remount-ro 0 1Finally, mount dev,sys and proc to the new root and chroot:janus@nasguld:/mnt/newroot$ sudo mount -o bind /dev /mnt/newroot/devjanus@nasguld:/mnt/newroot$ sudo mount -t proc none  /mnt/newroot/procjanus@nasguld:/mnt/newroot$ sudo mount -t sysfs none /mnt/newroot/sysjanus@nasguld:/mnt/newroot$ sudo parted /dev/sdb set 5 boot on janus@nasguld:/mnt/newroot$ sudo chroot .We are now chrooted to the future root exactly as it will look. According to Maciej, it should be ok to just call grub-install, but I did an update-grub first to get a look at the generated /boot/grub/grub.cfg before installing the bootloader. I am not sure it will be automatically updated?root@nasguld:/# update-grubroot@nasguld:/# grub-install /dev/sdb
Debian/Grub2: Moving root partition to new drive?
debian;grub2
Mount basic filesystems and copy/modify files while chrooting like:/dev (mount -o bind /dev/ /path/to/chroot/dev)/proc (mount -t proc none /path/to/chroot/proc)/sys (mount -t sysfs none /path/to/chroot/sys)IIRC that worked for me while installing Grub 2 in arch and numerous times on Gentoo. Then after chroot to /path/to/chroot command was simply:grub-install /dev/<boot_disk>As of lvm2 (and I belive madm but I haven't used it) the configuration is stored on disk. There is configuration what should be read to discover devices. Assuming your devices are in standard locations (/dev/sd* or /dev/hd*) there should be no problem.PS. I would not trust simple cp of live system as there are several places where it can go wrong:Forgot to change /etc/fstab and other useful filesFiles changed during accessCoping garbage (/tmp etc.)