简体   繁体   English

备份和还原e2image如何正确传输lzop的输出?

[英]backup and restore e2image how do I properly pipe the output from lzop?

I have for the longest time used dd with gzip as my backup solution. 我使用dd和gzip的备份时间最长。 I have been experimenting with faster ways of backing up. 我一直在尝试更快的备份方式。

on my Ubuntu 18.04 system, so far this was the quickest for creating a compressed backup image of an ext2/3/4 partition: 在我的Ubuntu 18.04系统上,到目前为止,这是创建ext2 / 3/4分区的压缩备份映像最快的方法:

sudo e2image -ra -p /dev/sda1 - | lzop -1 > `date +%F`.e2image2.lzo

when performing the above command sda1 is not mounted, I am booted into sdb1. 当执行上述命令时,未挂载sda1时,我被引导到sdb1中。 For anyone interested in that topic, i just worked it out here: https://askubuntu.com/questions/1063085/ 对于任何对此主题感兴趣的人,我都在这里解决了这个问题: https : //askubuntu.com/questions/1063085/

Now that I have the backup image, 2018-08-08.e2image.lzo , I need a way to restore it to /dev/sda1 现在我有了备用映像2018-08-08.e2image.lzo ,我需要一种将其还原到/ dev / sda1的方法

The lzop man page gives this example for tar: lzop手册页给出了tar的以下示例:

lzop -dc some-file.tar.lzo | tar -xvf -

I am trying to adapt that example by piping the output of the lzop decompression example to e2image: 我试图通过将lzop解压缩示例的输出传递到e2image来适应该示例:

lzop -dc 2018-08-08.e2image.lzo | e2image -ra -p - /dev/sda1

e2image 1.44.1 (24-Mar-2018)
e2image: No such file or directory while trying to open -

e2image does not seem to like the way I specified the input file as "-" which I thought was the proper way of using standard input when using a pipe. e2image似乎不喜欢我将输入文件指定为“-”的方式 ,我认为这是在使用管道时使用标准输入的正确方式。

Any help figuring out the problem here appreciated. 任何帮助解决这里的问题的帮助。

I would have also used the tags e2image and lzop, but I do not have enough reputation to add those new tags. 我也应该使用标签e2image和lzop,但是我没有足够的声誉来添加这些新标签。

You can just pipe the output from lzop to dd; 您可以将输出从lzop传递到dd; that's probably the simplest and most consistent way. 这可能是最简单,最一致的方法。

If you know that the output device has been pre-initialized to all zero's, you can use the make-sparse.c program found in the contrib directory of e2fsprogs. 如果您知道输出设备已预先初始化为全零,则可以使用e2fsprogs的contrib目录中的make-sparse.c程序。 The make-sparse program will skip writing blocks which are all zero's, and lseek to the offset where there is a non-zero block, and write only the non-zero blocks. make-sparse程序将跳过写全为零的块,并查找存在非零块的偏移量,仅写非零块。 If there are data files which have all zero blocks, and the block device is not pre-initialized to all zeros, then using make-sparse to write to the block device will result in the data file getting corrupted. 如果存在具有全零块的数据文件和块设备没有被预先初始化为全零,然后用化妆稀疏写入的块设备将导致数据文件越来越损坏。 The make-space progam is designed for use when taking the e2image file and writing it to a sparse file. 生成空间程序是为获取e2image文件并将其写入稀疏文件而设计的。

But the simplest way is to just use dd: 但是最简单的方法是只使用dd:

lzop -dc 2018-08-08.e2image.lzo | dd of=/dev/sda1 bs=4k

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM