Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Copying Gentoo from one disk to another
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
auryx
n00b
n00b


Joined: 01 Mar 2006
Posts: 4
Location: Belfast, N.Ireland

PostPosted: Wed Mar 01, 2006 4:34 pm    Post subject: Copying Gentoo from one disk to another Reply with quote

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
View user's profile Send private message
soulwarrior
Guru
Guru


Joined: 21 Oct 2002
Posts: 331

PostPosted: Wed Mar 01, 2006 4:48 pm    Post subject: Re: Copying Gentoo from one disk to another Reply with quote

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
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Mar 01, 2006 5:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
rsa4046
l33t
l33t


Joined: 07 Feb 2005
Posts: 660
Location: The Big H, a bit SSW

PostPosted: Wed Mar 01, 2006 5:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
auryx
n00b
n00b


Joined: 01 Mar 2006
Posts: 4
Location: Belfast, N.Ireland

PostPosted: Wed Mar 01, 2006 11:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
fkryszon
n00b
n00b


Joined: 01 Nov 2004
Posts: 64
Location: Belgium

PostPosted: Sat Apr 08, 2006 9:25 am    Post subject: Reply with quote

check out this one:
http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_%28stage4%29
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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