Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help cloning Gentoo to smaller disk
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
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Sun Jul 01, 2007 1:46 pm    Post subject: Help cloning Gentoo to smaller disk Reply with quote

I have an unusual setup, and I need some help cloning my working Gentoo to a new hard disk.

(1) I boot gentoo from a 160 gb external USB drive (its a company laptop-- no mods allowed). Windows is on sda, the internal laptop hd. Gentoo is on sdb, the external USB.

(2) I need to put my entire gentoo installation (three partitions /boot / and swap) on a smaller USB that I can power from the usb port. It's much easier to travel with the smaller drive. When I plug in the smaller 60 gb usb, it appears as sdc.

(3) When I am done with the clone, I need to be able to unplug the 160 gb drive, reboot the machine and have it boot from the cloned 60 gb usb drive.

If i use dd if=/dev/sdb of=/dev/sdc there will not be enough space for bit copy to the smaller drive.
if i use dd if=/dev/sdb skip=2 of=/dev/sdc seek=2 will I get the boot record correctly? What about the partition table?

is there a better way to do this? and can it be done using the live system.. e.g. not using a live CD?
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sun Jul 01, 2007 2:06 pm    Post subject: Reply with quote

create the partitions and filesystems on the target disk manually and use rsync to sync the source and target filesystems.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Sun Jul 01, 2007 8:20 pm    Post subject: Reply with quote

I have tried your suggestion. Made the file systems on the target drive. rcyned /boot successfully, but I get errors trying to rsync / because of /proc and /sys-- files not being present.

How do I rsync my root tree, making sure I get everything I will need to boot from the device when finished? If I exclude /proc and /sys will this work?
Back to top
View user's profile Send private message
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Sun Jul 01, 2007 10:47 pm    Post subject: Reply with quote

This technique failed for me.

(1) could not boot... no mbr
(2) could not rsync proc and sys...

I don't have much confidence that I even got most of the files...
any other suggestions would be very welcome.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Jul 01, 2007 11:22 pm    Post subject: Reply with quote

/proc and /sys are not part of the disk filesystem anyway, so it does not matter. Run "mount" and note they have their own entries.

For the mbr, set up grub. You need to set up grub anyway.

I would have used:
Code:
cp -ax /mnt/sda1/* /mnt/sda2/

After formatting sda2 and mounting them both from within a LiveCD.
Back to top
View user's profile Send private message
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Mon Jul 02, 2007 7:14 pm    Post subject: Just a little more help cloning Gentoo to new drive, please Reply with quote

Ok... I'm almost there.. thanks

Now I am very confused and nervous how to setup grub. I can't afford to damage my Windows install..

When I boot from the live CD: WIndows is on /dev/sda, and my usb is /dev/sdb.

WIth the USB plugged in, I boot from the USB first...
WIth it unplugged, I boot from /dev/sda and windows (corporate laptop)

Now, I need to setup a boot mbr on my cloned USB drive (another, but smaller, USB drive) it too is /dev/sdb.

Can someone point me too a resource, or give me certain instructions on how to proceed?

I found these directions from a Howto Move Gentoo... but I am not certain what the correct hd# is in grub:

rm -Rf /boot/*
mount -t ext2 /dev/sdb1 /boot
mkdir /newHD
mount -t ext3 /dev/sdb3 /newHD
/newHD/sbin/grub

root (hd0,1)
setup (hd0)
quit

If I use the wrong hd# will I ruin my windows mbr?... I can't afford to do that.
Back to top
View user's profile Send private message
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Mon Jul 02, 2007 8:49 pm    Post subject: Problem Solved:Help Cloning Gentoo to a smaller disk Reply with quote

Followed Paul's advice... used the cp -a command. Worked like a charm.

Then, simply removed the Windows drive /dev/sda from laptop.

Ran the recommended grub procedure using root( hd0,0) (no risk this way, obviously)

Re-installed /dev/sda
Plugged in the external USB
Rebooted into my working Gentoo

You guys are great! as usual.

Thanks.
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