root partition move

Tyler Aviss tjaviss-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Jul 27 01:09:22 UTC 2009


On Sun, Jul 26, 2009 at 5:52 PM, James Knott<james.knott-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org> wrote:
> Rajinder Yadav wrote:
>> A while back I saved my linux partition using a rescue disk along with
>> partimage.
>> I recently did a restore of the system without any issues just to
>> verify the process, because I like to tinker with stuff =)
>>
>> I am wondering though, would it be possible to move the root partition
>> to another partition during the restore? What would be required to
>> tell the kernel to use say /dev/sdb2 instead of /dev/sdb8 to mount
>> root? a simple change to /etc/fstab?
>>
>> Would the partition move break any other programs from running, or
>> linkage i.e. /etc/ld.so.conf? or is stuff in here pretty self
>> contained to the file structure layout irrelevant to what partition
>> it's mounted on?  I would think is the case.
>>
>>
> That should be OK, but you'll have to edit /etc/fstab, to reflect the
> changes.
>
> --
> The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
Be sure to update /boot/grub/menu.lst (or /etc/grub.conf) if you're
using GRUB, and /etc/lilo.conf if you're using LILO.

For GRUB you'll need to update the sections like
root (hd0,0)
and kernel /vmlinuz root=/dev/sda1
and if you have it the line for the menu background (splashimage?)

For the "root" part in grub, drives in GRUB start at 0, so if your
root was on the first partition of the first disk it would be (hd0,0),
and sda2 would be (hd0,1) etc. If you're using a separate boot
partition, notably for XFS users etc, then the "root (hd0,0)" would
actually be whatever /boot is mounted as.

If you get stuck, post know what your actual before/after partition
layout is and I can probably sort it out.GRUB's not that difficult
once you figure out the whole numbered partition thing,but it can be
annoying.


Anothe note: Sometimes, especially with Ubuntu, you may have UUID's in
the grub.conf or menu.lst and /etc/fstab. While the idea is nice, I
prefer to replace these with physical mappings as somebody they get
messed up with kernel updates or drive changes.

And lastly, a useful trick is to label partitions when you're
assigning a filesystem (or after with tune2fs, xfs_admin, etc) then
you can have fstab entries like
LABEL:root    /  ext3        relatime   00
etc

The only thing to watch out for with that is that you don't have
duplicate labels or for example a USB drive with the same label as a
physical disk, etc.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list