Re: Clone root partition
- From: Digby Tarvin <digbyt@xxxxxxx>
- Date: Sat, 30 Dec 2006 18:13:26 +0000
I did this only yesterday - but in my case I wanted a mirror
image of the entire system, not just the root partition.
The simplest most bullet proof procedure I could come up with was:
1. dd if=/dev/hda of=/dev/sda
2. vi /etc/fstab in the copy and 1,$s/hda/sda/
3. either
a. edit /boot/grub/menu.lst on the internal drive
to add a boot obtion passing the USB root to the kernel
or
b. if your host supports USB booting, update the boot sector
on sda to look for the stage 2 boot in the USB partition.
I used for first option, so am not sure if I have covered everything
required for a direct USB boot...
I booted using the USB copy and everything looked to be working fine.
Didn't use 'sync,noerror' in the dd operation because I count on having
perfect media, and if I don't I want to know about it!
Regards,
DigbyT
On Sat, Dec 30, 2006 at 05:45:34PM +0000, T wrote:
Hi,
I'm trying to compile a comprehensive document on cloning root partitions.
My immediate goal is to clone my current working Linux to external USB HD,
so that I can use it wherever I go.
By comprehensive I mean it should not be as simple minded as
dd if=/dev/hda2 of=/dev/sda2
or
cp -a / /mnt/point
or
tar -p -m cf - / | (cd /mnt/point; tar xf - )
I know they work, but there are so many things have been left out. By
comprehensive, I mean I want to know all relevant things that need to be
considered.
For example for dd, let alone its rigid limitation, if you use it, at least
the 'conv=sync,noerror bs=4k' options should be used: sync,noerror just
means continue and zero fill any error blocks, bs=4k just writes 4k at a
time which will speed things up a lot. For cp, at least 'cp -ax' should be
used.
But there are still much more to it.
First, directories that don't need to copy over, like /tmp, /proc. With
modern Linux that uses udev, the /dev and /sys don't need to be copied
either. Anything else (besides distro specifics like /var/cache/apt/archives)?
2nd, the clone partition should be made bootable, by grub or lilo.
Anything else? Like the concerns of /etc/fstab...
Last, with all the above concerns, how to achieve them with various tools?
Keywords: tar rsync find cpio dd
thanks
PS. If you come across this message late, be it a week or even a month
late, please do comment, I hope this thread can be a one stop place for
people looking for concerns over cloning root partitions.
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
--
Digby R. S. Tarvin digbyt(at)digbyt.com
http://www.digbyt.com
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- Follow-Ups:
- Re: Clone root partition
- From: Alejandro
- Re: Clone root partition
- From: Hugo Vanwoerkom
- Re: Clone root partition
- References:
- Clone root partition
- From: T
- Clone root partition
- Prev by Date: Re: bridging eth1 to eth0
- Next by Date: Re: GUI and USB question
- Previous by thread: Clone root partition
- Next by thread: Re: Clone root partition
- Index(es):
Relevant Pages
- Re: Sarge and RAID
... hold the boot, swap and root partitions, while the two 250GB disks ... configuration
/dev/md0 does not get initilaized on boot. ... need to change your initrd.gz to insmod/modprobe
the raid drivers ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
... (Debian-User) - Re: Clone root partition
... if your host supports USB booting, ... I'm trying to compile a comprehensive
document on cloning root partitions. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". ... (Debian-User) - Re: Clone root partition
... if your host supports USB booting, ... I'm trying to compile a comprehensive
document on cloning root partitions. ... Suppose I have a production server with
a /dev/sda disk and I mount a second disk /dev/sdb in order to clon sda to sdb. ... (Debian-User) - Re: how can I boot from USB? or with Live CD?
... I think the question is simple: I have Windows XP, I can boot with 2 linux,
the "PCLinuxOS 2007" and "Knoppix Linux" with USB with my portable computer, the question is:
how can I boot from your linux with USB? ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". ... (Debian-User) - Re: [SLE] MB replaced, can boot, but cant load OS (Suse 9.3)
... Mount the boot and root partitions so that boot is under root, ... edit
/etc/sysconfig/kernel on the hard disk. ... Chroot to the root partition on the
disk and run mkinitrd as root to ... (SuSE)