Transferring disks with partimage

Fred Roller froller at tnclimited.com
Thu Jul 16 22:28:41 UTC 2009


On Tue, 2009-07-14 at 10:43 +0200, Joep L. Blom wrote:
> Following my question of 07/12/09 I would like to know if anybody has 
> experience with transferring partitions over the network to another system.
> As I wrote I want to transfer partitions (> 10) to another system on one 
> disk. I found I can use partimage to make an imagefile and transfer it 
> either directly or indirectly to the other system.
> However, I have the following questions:
> 1.	 When I restore the image do I need an unformatted partition?
> 2.	Can I combine several partition images into one restored image?
> I hope somebody has experience with it. Googling I didn't found relevant 
> information.
> Joep
> 

If you don't mind I am going to start from the top, in part to keep this
straight in my own head.  You want to:

-Move multiple partitions.
-over a network.
-to a new system.
-These partitions would best be consolidated.
-New hdd is larger than existing hdd AND empty.

If the above is correct then:
boot both systems to liveCD and open a terminal in both and run the
following commands.

$ sudo apt-get install ssh
$ sudo passwd root
[enter easy password]
$ ifconfig
(sys1=192.168.0.1)
(sys2=192.168.0.2) for my examples, change as needed.

ssh is not native to ubuntu so we need to install it.  And don't worry
about our normal safe practices, this is a live session and thus not
persistent.

Assuming the older system (sys1) will be our working system then while
focus is on terminal window press:

ctl+alt+t

to open another tab in the terminal and run

$ ssh -l root 192.168.0.2
#
this is optional so we can work from one station.

where the ip matches the receiving system (sys2)

$ df -h

make sure we do not see anything similar to:
/dev/sda1	7.5G	3.2G	4.0G 45% /mnt

you are looking for anything with the /dev/sda*
IF you see it there like above then run:

$ sudo umount /mnt

where /mnt = mount point listed above, adjust accordingly.

assuming both systems only have one hard drive and assuming both are
sata the they should both be /dev/sda.

$ ls /dev/sd*

on both systems to see all sata/scsi devices

from the SOURCE pc sys1 run:

*********IMPORTANT*************
MAKE SURE YOU RUN THIS COMMAND FROM THE SOURCE PC OR YOU WILL ERASE YOUR
DATA!!
*******************************

$ sudo dd if=/dev/sda |ssh root at 192.168.0.2 "dd of=/dev/sda bs=4028
conv=notrunc"

enter the password you created earlier.

Once the command starts go get dinner.  Depending on your SOURCE disk
size this will take some time.  I believe around 12Mb/sec on average
[80,000/12/60/60=1.85hrs] for an 80Gb drive.  dd should exit without
errors.

You should be able to mount the partitions and check the data, etc.

$ sudo mount /dev/sda1 /mnt

to combine the partitions (not the command, again I apologize for that
confusion.) GUI might serve best.  If ANYONE knows a faster better way
please fill in.

go to the sys2 and close the terminal, and open partition editor

System->Administration->Partion Editor

Right click and choose Resize/Move the partitions that are going to be
merged into sda1 and move them to the end of the unallocated space.
Once moved, expand sda1 to the free remaining space now available on
it's backside.  

Once this completes, copy your data over to the new space. Delete the
unwanted partitions and expand the primary into the available space.

mount your primary partition and adjust your fstab to not mount the
older partitions.  I went with the GUI because I don't know how much you
know and this is the easiest interface to play musical partitions.  If
you don't mess with the SOURCE drive then you have a fall back point to
try again if you need to.

This is simply how I would do it given what I know.  Perhaps there is an
easier way, until then this will hopefully help you.  Good luck.




-- 
Fred R.
www.fwrgallery.com

"Life is like Linux, simple.  If you are fighting it, you are doing
something wrong."







More information about the ubuntu-users mailing list