
克隆ubuntu硬盤
Whether you’re setting up multiple computers or doing a full backup, cloning hard drives is a common maintenance task. Don’t bother burning a new boot CD or paying for new software – you can do it easily with your Ubuntu Live CD.
無論是設置多臺計算機還是進行完整備份,克隆硬盤驅動器都是一項常見的維護任務。 不必費心刻錄新的引導CD或購買新軟件-您可以使用Ubuntu Live CD輕松完成此操作。
Not only can you do this with your Ubuntu Live CD, you can do it right out of the box – no additional software needed! The program we’ll use is called dd, and it’s included with pretty much all Linux distributions. dd is a utility used to do low-level copying – rather than working with files, it works directly on the raw data on a storage device.
您不僅可以使用Ubuntu Live CD進行此操作,而且還可以立即使用,無需其他軟件! 我們將使用的程序稱為dd ,幾乎所有Linux發行版都包含該程序。 dd是用于執行低級復制的實用程序-而不是處理文件,它直接對存儲設備上的原始數據起作用。

Note: dd gets a bad rap, because like many other Linux utilities, if misused it can be very destructive. If you’re not sure what you’re doing, you can easily wipe out an entire hard drive, in an unrecoverable way.
注意: dd的說唱不好,因為和許多其他Linux實用程序一樣,如果濫用,它可能會造成很大的破壞。 如果不確定自己在做什么,則可以以不可恢復的方式輕松擦除整個硬盤。
Of course, the flip side of that is that dd is extremely powerful, and can do very complex tasks with little user effort. If you’re careful, and follow these instructions closely, you can clone your hard drive with one command.
當然,另一方面是dd非常強大,可以用很少的用戶精力來完成非常復雜的任務。 如果小心,并嚴格按照以下說明進行操作,則可以使用一個命令克隆硬盤驅動器。
We’re going to take a small hard drive that we’ve been using and copy it to a new hard drive, which hasn’t been formatted yet.
我們將使用一個一直在使用的小型硬盤驅動器,并將其復制到尚未格式化的新硬盤驅動器上。
To make sure that we’re working with the right drives, we’ll open up a terminal (Applications > Accessories > Terminal) and enter in the following command
為了確保我們使用的驅動器正確,我們將打開一個終端(“應用程序”>“附件”>“終端”),然后輸入以下命令
sudo fdisk –l
sudo fdisk –l

We have two small drives, /dev/sda, which has two partitions, and /dev/sdc, which is completely unformatted. We want to copy the data from /dev/sda to /dev/sdc.
我們有兩個小型驅動器,/ dev / sda,具有兩個分區,/ dev / sdc,其完全未格式化。 我們想要將數據從/ dev / sda復制到/ dev / sdc。
Note: while you can copy a smaller drive to a larger one, you can’t copy a larger drive to a smaller one with the method described below.
注意:雖然您可以將較小的驅動器復制到較大的驅動器,但是不能使用以下方法將較大的驅動器復制到較小的驅動器。
Now the fun part: using dd. The invocation we’ll use is:
現在有趣的部分:使用dd 。 我們將使用的調用是:
sudo dd if=/dev/sda of=/dev/sdc
須藤dd if = / dev / sda of = / dev / sdc
In this case, we’re telling dd that the input file (“if”) is /dev/sda, and the output file (“of”) is /dev/sdc. If your drives are quite large, this can take some time, but in our case it took just less than a minute.
在這種情況下,我們告訴dd輸入文件(“ if”)是/ dev / sda,輸出文件(“ of”)是/ dev / sdc。 如果您的驅動器很大,則可能要花一些時間,但對于我們而言,它只花了不到一分鐘的時間。

If we do sudo fdisk –l again, we can see that, despite not formatting /dev/sdc at all, it now has the same partitions as /dev/sda.
如果再次執行sudo fdisk –l ,則可以看到,盡管根本不格式化/ dev / sdc,但它現在具有與/ dev / sda相同的分區。

?Additionally, if we mount all of the partitions, we can see that all of the data on /dev/sdc is now the same as on /dev/sda.
另外,如果我們掛載了所有分區,我們可以看到/ dev / sdc上的所有數據現在與/ dev / sda上的相同。

Note: you may have to restart your computer to be able to mount the newly cloned drive.
注意:您可能必須重新啟動計算機才能掛載新克隆的驅動器。
And that’s it…If you exercise caution and make sure that you’re using the right drives as the input file and output file, dd isn’t anything to be scared of. Unlike other utilities, dd copies absolutely everything from one drive to another – that means that you can even recover files deleted from the original drive in the clone!
就是這樣...如果您謹慎行事,并確保使用正確的驅動器作為輸入文件和輸出文件,則dd沒什么好擔心的。 與其他實用程序不同, dd絕對將所有內容從一個驅動器復制到另一個驅動器-這意味著您甚至可以恢復從克隆中原始驅動器刪除的文件!
翻譯自: https://www.howtogeek.com/howto/19141/clone-a-hard-drive-using-an-ubuntu-live-cd/
克隆ubuntu硬盤