ubuntu 映像_使用Ubuntu Live CD通过网络传输驱动器映像

ubuntu 映像

ubuntu 映像

Drive images are great to have, but hard to store if you don’t have a big external hard drive. We’ll show you how to create and transfer a drive image to another computer in one step.

驱动器映像很不错,但是如果没有大型外部硬盘驱动器,则很难存储。 我们将向您展示如何在一个步骤中创建驱动器映像并将其传输到另一台计算机。

The Ubuntu Live CD includes both utilities that we need for the source and destination computers out of the box – dd and ssh.

Ubuntu Live CD包括现成的源计算机和目标计算机所需的两个实用程序ddssh

sshot-5

We’re fans of dd, having used it to clone hard drives and make drive images locally in the past. However, putting an image on an external drive and then transferring that to a different computer is a pain. Using a combination of dd and ssh lets us transfer a drive image from one computer to another in one step, requiring no local storage in between.

我们是dd的粉丝,过去曾用它来克隆硬盘驱动器在本地制作驱动器映像 。 但是,将图像放在外部驱动器上然后将其传输到另一台计算机上是很痛苦的。 使用ddssh的组合,我们可以一步将驱动器映像从一台计算机传输到另一台计算机,而无需在其间进行本地存储。

To set this up, you will need two computers, both running Linux. Of course, you can boot both computers up with an Ubuntu Live CD and this method will work great – you will need two separate Live CDs or USB drives, however. Ideally, both computers would be on the same local network, as transfer speeds will be much faster, but you can do this for most computers that you have ssh access to.

要进行设置,您将需要两台都运行Linux的计算机。 当然,您可以使用Ubuntu Live CD引导两台计算机,此方法将非常有用-但是,您将需要两个单独的Live CD或USB驱动器。 理想情况下,两台计算机都应位于同一本地网络上,因为传输速度会更快,但是您可以对大多数拥有ssh访问权限的计算机执行此操作。

The first step is to boot up the computer you want to store the drive image on – the destination computer – and find its IP address. We’ve described several methods previously, but the most direct way is to open up a terminal and enter the command ifconfig.

第一步是启动要在其上存储驱动器映像的计算机-目标计算机-并找到其IP地址。 前面已经介绍了几种方法 ,但是最直接的方法是打开终端并输入命令ifconfig

Make a note of the computer’s IP address – if it’s on your local network, it should start with 192.168.

记下计算机的IP地址-如果它在您的本地网络上,则应以192.168。开头

While you’re on that computer, also make sure that you have a place to store the drive image. Make sure that location is mounted, and make a note of its full path (for example, a newly mounted hard drive may have the path /media/HD-LABEL/).

在那台计算机上时,还请确保您有存储驱动器映像的位置。 确保已安装该位置,并记下其完整路径(例如,新安装的硬盘驱动器可能具有路径/ media / HD-LABEL /)。

Boot up the computer that has the drive you want to image using an Ubuntu Live CD.

使用Ubuntu Live CD启动具有您要映像的驱动器的计算机。

First, ensure that you can ssh into the destination computer by opening a terminal window (Applications > Accessories > Terminal) and entering the command:

首先,通过打开终端窗口(“应用程序”>“附件”>“终端”)并输入以下命令,确保可以进入目标计算机:

ssh <username>@<destination IP address>

ssh <用户名> @ <目标IP地址>

If you’re doing this on the local network, and the destination computer is also running off of an Ubuntu Live CD, then the command should look something like

如果您在本地网络上执行此操作,并且目标计算机也使用Ubuntu Live CD运行,则命令应类似于

ssh ubuntu@192.168.xxx.xxx

ssh ubuntu@192.168.xxx.xxx

In our case, we’re accessing a remote Linux machine.

就我们而言,我们正在访问一台远程Linux计算机。

sshot-1

If you can ssh in with no problems, then type in “exit” to return to the normal terminal window on your source computer.

如果您可以顺利插入,请键入“退出”以返回到源计算机上的常规终端窗口。

Now, we need to find the hard drive or hard drive partition that you want to make an image of. In the terminal window, enter in the command

现在,我们需要找到要为其制作映像的硬盘驱动器或硬盘驱动器分区。 在终端窗口中,输入命令

sudo fdisk –l

sudo fdisk –l

sshot-2

In our case, we want to make an image of a small Linux partition, /dev/sda1. We’ll make a note of this device name.

在我们的例子中,我们要制作一个小型Linux分区/ dev / sda1的映像。 我们将记下该设备名称。

Now the complicated part: the dd invocation. Here’s a generic version…

现在是复杂的部分: dd调用。 这是通用版本…

sudo dd if=<input device> | ssh <user>@<destination IP address> “dd of=<destination path>”

sudo dd if = <输入设备> | ssh <用户> @ <目标IP地址>“ dd of = <目标路径>”

It looks complicated, but if you look piece-by-piece it should make sense. What may be new to you is the “|” character, which in Linux terms is called a “pipe”. It takes the output from the first half of the line (the dd if=<input> part) and sends it to the second half of the line (the ssh part) – or, it “pipes” the result of the left part to the right part.

它看起来很复杂,但是如果您逐个看它应该很有意义。 对您来说,新内容可能是“ |” 字符,在Linux中称为“管道”。 它从行的前半部分( dd if = <input>部分)获取输出,并将其发送到行的后半部分( ssh部分)–或者,将“左”部分的结果“传递”到正确的部分。

In our example, we’ll be storing the drive image on a remote Linux machine, so our terminal command is:

在我们的示例中,我们将驱动器映像存储在远程Linux机器上,因此我们的终端命令是:

sudo dd if=/dev/sda1 | ssh tbekolay@xxx.xxx.45.127 “dd of=/home/tbekolay/LinuxPart.image”

sudo dd if = / dev / sda1 | ssh tbekolay@xxx.xxx.45.127“ dd of = / home / tbekolay / LinuxPart.image”

If you’re doing this over the local network, and your destination computer is running an Ubuntu Live CD, the command will be something like:

如果您通过本地网络执行此操作,并且目标计算机运行的是Ubuntu Live CD,则命令将类似于:

sudo dd if=/dev/sda1 | ssh ubuntu@192.168.xxx.xxx “dd of=/media/HD-LABEL/LinuxPart.image”

sudo dd if = / dev / sda1 | ssh ubuntu@192.168.xxx.xxx“ dd of = / media / HD-LABEL / LinuxPart.image”

sshot-3

Since we did this over the internet rather than on the local network, the speed is quite slow, but it did finish eventually. Doing this over a local network will go much faster.

由于我们是通过Internet而不是在本地网络上执行此操作的,因此速度相当慢,但最终确实完成了。 通过本地网络执行此操作将更快。

Just to make sure, we accessed the destination computer again using ssh to make sure that the drive image was indeed created and transferred successfully.

为了确保这一点,我们再次使用ssh访问了目标计算机,以确保确实创建并成功传输了驱动器映像。

sshot-4

Success!

成功!

With only one line typed into a terminal window, we were able to create an image of a partition on our local computer, and store that image on a computer miles away. Of course, this was a small partition; a much larger partition or a whole hard drive would be difficult to send over the internet, but this method will work great over a local network too!

只需在终端窗口中键入一行,就可以在本地计算机上创建分区的映像,并将该映像存储在相距不远的计算机上。 当然,这是一个很小的分区。 更大的分区或整个硬盘驱动器将很难通过Internet发送,但是这种方法也可以在本地网络上很好地工作!

翻译自: https://www.howtogeek.com/howto/21257/transfer-a-drive-image-over-a-network-using-an-ubuntu-live-cd/

ubuntu 映像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值