View previous topic :: View next topic |
Author |
Message |
auryx n00b
Joined: 01 Mar 2006 Posts: 4 Location: Belfast, N.Ireland
|
Posted: Wed Mar 01, 2006 4:34 pm Post subject: Copying Gentoo from one disk to another |
|
|
Hi All,
I'm a Gentoo (and Linux) newbie, but have managed to set up my installation OK, it's working fine.
Unfortunately, it's on a rather small hard disk, and I'm going to run out of space in no time at all.
If I buy another HDD, is there a way of just copying the entire installation across, and then just increasing the size of my root partition? I don't really want to have to reinstall Gentoo, but suspect I might have to.
Thanks in advance for any advice, sorry if this is a stupid question. I'm using a dual-boot Pentium IV system with Windows XP also installed on another hard drive.
Cheers,
Michael. |
|
Back to top |
|
|
soulwarrior Guru
Joined: 21 Oct 2002 Posts: 331
|
Posted: Wed Mar 01, 2006 4:48 pm Post subject: Re: Copying Gentoo from one disk to another |
|
|
auryx wrote: |
If I buy another HDD, is there a way of just copying the entire installation across, and then just increasing the size of my root partition? I don't really want to have to reinstall Gentoo, but suspect I might have to.
|
Should be no problem with linux. Did this myself several times.
Normally I use a livecd like Knoppix to transfer the system from one partition to another with the help of tar.
You could use something like:
Code: |
cd /mnt/old_mounted_system_partion
tar cfl - . | (cd /mnt/new_parition; tar xpvf -)
|
The p option is important to preserve the right permissions.
The l option, so it stays on the local filesystem and doesn't follow symlinks.
Greetings from soulwarrior |
|
Back to top |
|
|
nevynxxx Veteran
Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Wed Mar 01, 2006 5:12 pm Post subject: |
|
|
Another way, if both file systems are mounted is cp -a.
This, also, keeps permissions amongst other things. _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
|
rsa4046 l33t
Joined: 07 Feb 2005 Posts: 660 Location: The Big H, a bit SSW
|
Posted: Wed Mar 01, 2006 5:33 pm Post subject: |
|
|
Modifications of the scheme described here might be helpful. There are any number of ways to do this, assuming you can access the two drives simultaneously. Just physically install the new drive (e.g., if IDE, install on the secondary IDE channel), boot your existing system, become root, run fdisk -l to list the devices, partition the new drive accordingly, make the filesystems (ext3, reiserfs, etc.) for these partitions (mke2fs, mkreiserfs, etc.), mount the (what will become new root) partition's fs as /mnt/tmp, then push a tar backup of root to the new drive, excluding /dev /sys and /proc but preserving permissions (umount anything else mounted in /mnt) e.g. Code: | # TARGETS="/bin /home /opt /root /usr /boot /etc /lib /mnt /sbin /var"
# find $TARGETS -type s > /tmp/sockets | You can find the total size of the backup by first TARring to null Code: | # DEVICE=/dev/null
# tar -cpf $DEVICE $TARGETS --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/mnt/tmp --exclude-from=/tmp/sockets --totals | grep Total | Then run tar for real with a pipe: Code: |
# tar -cp $TARGETS --exclude=/mnt/tmp --exclude-from=/tmp/sockets --totals | tar -C /mnt/tmp -xpv |
You can also just tar from / and use exclude statements, e.g. Code: | # tar -cp / --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/mnt/tmp --exclude-from=/tmp/sockets --totals | tar -C /mnt/tmp -xpv | At that point you should be able to just edit grub or lilo to point to the new root (root=/dev/<newrootdevice>), keeping the pointers to your existing kernel image intact. Probably making a second entry in grub.conf and preserving the working entry is safest until you get any bugs worked out. HTH |
|
Back to top |
|
|
auryx n00b
Joined: 01 Mar 2006 Posts: 4 Location: Belfast, N.Ireland
|
Posted: Wed Mar 01, 2006 11:45 pm Post subject: |
|
|
Hi Guys,
That's great, thanks very much for the suggestions. I'm glad it's possible. Much as I'm getting to like Gentoo, the thought of having to compile all that stuff from scratch again was getting me worried
I'll purchase my new drive ASAP and give it a try, I might be back here for more advice if I get stuck.
Thanks again!
Mike. |
|
Back to top |
|
|
fkryszon n00b
Joined: 01 Nov 2004 Posts: 64 Location: Belgium
|
|
Back to top |
|
|
|
|
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
|
|