还是无视这篇文章
Clonezilla – Clone System Ubuntu
看这篇吧
下午搞了一下午这个玩意
当然,直接看网上的教程是用dd if=/dev/sda of=/dev/sdb 这种方法,但是每次copy之后就会出现
dd: reading `/dev/scd1': Input/output error 1053920+0 records in 1053920+0 records out
这种错误,然后直接把硬盘接到另外一台机器开启之后,GRUB error 18或者error 2
于是很无奈的没办法解决……
刚刚又仔细的在网上看了下教程
If you’ve ever wanted to completely clone your Ubuntu install, with all of the tweaks, files you’ve downloaded and changes you’ve made to it, there’s a fairly simple way to do this. This is great if you want a complete backup, or if you’re looking to move your system to a newer (read: bigger, faster, stronger) hard drive or even just to clone your install to other machines with the same hardware.
We’ll be using the terminal (Applications-> Accessories-> Terminal) and the dd command to do this. You’ll also need to have your second disk up and running when we get going. You can either have it installed and mounted internally or use an external disk enclosure and USB or Firewire. (Note: Doing this via USB 1 will be excruciatingly slow!)
You’ll also want to either be cloning your hard drive to one of the exact same size, or if you have a larger disk, make a partition of the same size on it and clone to that. Then, use an Ubuntu liveCD to change the partition size (System-> Administration-> Partition Editor). Lastly, you’ll need a LiveCD.
On to the good stuff. Got both disks plugged in? Good! Now you’ll need to figure out which disk you are copying from and which disk you are copying too. In your terminal, type:
df -h
Look first for the partition that’s mounted at root, or ‘/’. Here’s what my root partition looks like.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 71G 46G 22G 68% /
If you’re using a SATA drive it will appear like that. IDE should be /dev/hda1. See that slash below the Mounted on? That’s the root drive.
Now you’ve got to locate the drive you’re copying too. The same df -h command will do the trick. Look for another disk mounted on /dev/****. If you’re not sure what you’re looking for, first run the df -h command without your second disk mounted. Then plug the 2nd disk in (be sure to shut down if you’re doing this inside your machine and not via USB or FireWire) and run the df -h command again. The newest partition that appears is what you’re looking for!
So if your current root partition is /dev/sda1 and the partition you’re going to copy to is /dev/sdb1 (a USB mounted drive) here’s the command you’ll need to type in your terminal:
sudo dd if=/dev/sda1 of=/dev/sdb1
Replace with the correct paths for your drives if they differ. It’s going to take a while, so grab a book or start up a movie. Maybe go to bed.
Once it’s complete, you’ve got yourself a brand new copy of your current Ubuntu install. You’re not quite done yet though. Now you’ve got to install Grub on your new disk so you can boot from it. Make sure your new disk is attached to your machine and your old disk is unplugged and boot into the Ubuntu LiveCD.
Once your machine boots up, open up a terminal session and type:
sudo grub
Grub will launch and give you the grub> prompt. Here, type:
find /boot/grub/stage1
You should see something come back that looks like hd(0,0). Jot that down, you’ll need it in a second.
Now, still in the grub> prompt, type:
root hd(0,0)
You’ll put in whatever result you go above – it may be different than hd(0,0).
Once that completes, type:
setup (hd0)
Even if you got a result that differs from hd(0,0) above.
Type:
quit
And you’re out of grub. Restart your machine, removing the LiveCD and you should be up and running on your new hard drive. You may also encounter a problem on your first boot where the system will try to scan your hard drive for bad sectors. If that fails, you’ll find yourself in a root terminal session. Just type:
fsck
Let the disk check finish and you should be good to go.
这篇真的不错,基本原理是一样的,只是用dd的时候用Live CD来启动系统,而不是我之前那样直接启动到系统里面再用系统去copy系统……这样可能有些东西在运行,无法copy,然后这个教程还讲到 copy完成之后,还要再修改新搞的硬盘的grub设置……怪不得我没设置,自然会出错 -_-


