# Cloning linux system to new hard drive



## kasse (Aug 19, 2009)

After I switched hard drives I moved my Freebsd to a new drive and now I would like to do the same with my Fedora 11.

The root partition is in a logical volume with ext4, so I could not use dump like in freebsd. So I tried to do it with rsync.

I have created the new logical volumes and formatted it with ext4 and (I guess) fixed the se-linux labels on it with "fixfiles relabel /dev/mapper/vg_dell2-lv_root" (at least I I get no labelling errors when I mount it). I mount it on /backup/root/

I then run "rsync -vaHxX --progress --numeric-ids / /backup/root/" following the guide http://www.sanitarium.net/golug/rsync_backups.html the "X" to keep the se-linux labels.
But the problem is that not all files are copied, like the selinux directory and the system does not boot up.

Does anyone know of an easy method recreate my linux system on another hard-drive? 

I know even less of linux than freebsd so I might do something really dumb.


----------



## dennylin93 (Aug 20, 2009)

What about `# dd if=/dev/ad0 of=/dev/ad1 bs=1m`? I've never tried this before, so I can't confirm that it works though.


----------



## kasse (Aug 21, 2009)

I wonder if this would work, since when I look at a post about copying a disk with dd at http://www.unix.com/filesystems-disks-memory/7243-use-dd-command.html

They mention 





> 2. The destination disk has to be identical to the source disk (including model
> number and geometry). This is because dd copies the entire disk image (including
> the label {vtoc}). So, if a 9Gb Seagate drive was dd'd to a 36Gb IBM drive, then
> after the operation, the 36Gb IBM drive would show up as a Seagate 9Gb and there
> is no easy way to reclaim the missing space.



I my case the disks are far from identical.


----------



## dennylin93 (Aug 22, 2009)

Good point. It might be worth giving Clonezilla a shot. Backup and restore the disk or use disk to disk cloning. It's possible to use Clonzilla even when the disks are different sizes.


----------



## kasse (Aug 23, 2009)

Actually I used clonezilla just to get it done, but I wanted to be able to do it to a live system , like with rsync/dump etc.


----------



## saxon3049 (Aug 29, 2009)

I like clonezilla, saves me effort and money over ghost which has sucked since version 12 onwards.

Edit:
I forgot to mention, my local school bought it's students HP Mini notes 2133's and clonezilla had issues with it with the latest release with them, and bless that school it's earned me a lot of cash from parents not wanting to pay Â£150 for the school to replace a hard disk or Â£350 for a new screen, it's amazing what them kid's can do to a computer in under a week. The day they got given out I had kids walking in asking me how to do XYZ to there laptop and a few day's later I had my first "Yea my kid was given a laptop from school and it's kinda got a virus where there is porn all over the desktop can you fix it?"


----------



## dennylin93 (Aug 31, 2009)

I've been trying to persuade my school to switch to Clonezilla. It would save a lot of money.

Many people still don't really trust open source stuff. They think that there isn't enough support.


----------

