克隆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硬盘