問題描述
製作linux系統的“副本” (Make a "copy" of linux system)
假設我有一個硬盤,上面有一些 linux 發行版。我的任務是在另一個硬盤驅動器上設置類似的系統(具有類似的發行版、內核版本、軟件版本等)。如果:
案例a:我可以使用任何我想要的軟件(包括Virtualbox之類的軟件來製作系統的完整映像)
案例b:除了標準的 linux 實用程序,我不能使用任何東西來檢索我需要的所有特性,然後手動在其他硬盤上安裝“新”系統。
感謝閱讀。我很難表達我的意思,希望你能理解。
參考解法
方法 1:
One word: CloneZilla
It can clone the partitions, disks, copies the boot record. You can boot it up from CD or USB drive or even via network (PXE).
You could go with dd but it's slow because it copies everything, even the empty space on disk, and if your partitions are not the same size you can have various problems, so I do not recommend dd.
You could also boot the system from some live CD like Knoppix, mount the partitios and copy everything using cp ‑a. And run something like watch df in a second terminal to monitor the progress. But even then you need to mess with the bootloader after copy is done.
I used to use various manual ways to clone Linux systems in the past, until I discovered CloneZilla. Life is much easier since then.
方法 2:
Easiest way is to use dd from the command prompt.
dd if=/dev/sda of=/dev/sdb ‑‑bsize=8096
dd (the disk duplicator) is used for exactly this purpose. I would check the man page to ensure my blocksize argument is correct though. The other two arguments are if (in file) and of (out file). The of= hard drive should be the same size or larger than the if= hard drive.
方法 3:
You can create an exact copy of the system on the first disk with dd or cpio and a live cd.
(by Scorpil、Milan Babuškov、Jim Nanney、antik)