TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A snapshot of your computer with dd, pv and gzip - Part 1

60 点作者 adito将近 12 年前

14 条评论

networked将近 12 年前
Consider using Clonezilla [1] instead. While dd will produce a sector-by-sector image of your medium (which can be terribly inefficient if you&#x27;re using considerably less than 100% of its available space) Clonezilla is file system-aware for a number of common file systems and has built-in support for compression as well. It resembles the recently discontinued Norton Ghost this way but is fully FOSS.<p>I normally run it off a live CD&#x2F;USB of Parted Magic [2], another tool I can wholeheartedly recommend.<p>[1] <a href="http://clonezilla.org/" rel="nofollow">http:&#x2F;&#x2F;clonezilla.org&#x2F;</a><p>[2] <a href="http://partedmagic.com/doku.php" rel="nofollow">http:&#x2F;&#x2F;partedmagic.com&#x2F;doku.php</a>
评论 #6071215 未加载
评论 #6071181 未加载
评论 #6071164 未加载
hapless将近 12 年前
Just by the by, this is a <i>terrible</i> idea to do online. The <i>best case</i> is a crash-consistent replica. The more likely case is an inconsistent one that may or may not be repairable, because of the length of time it takes to do the dump.<p>If you want a bit-for-bit dump of an online filesystem, use Linux LVM to create a snapshot, then make an image of that (100% known crash-consistent) copy.
rsync将近 12 年前
I don&#x27;t always backup an entire system with &#x27;dd&#x27;, but when I do:<p>dd if=&#x2F;dev&#x2F;da0 | ssh user@rsync.net &quot;dd of=backup.dd&quot;<p>or maybe:<p>pg_dump -U postgres db | ssh user@rsync.net &quot;dd of=db_dump&quot;
评论 #6071584 未加载
评论 #6071666 未加载
评论 #6073105 未加载
j_s将近 12 年前
I used dd booting from a USB stick to transfer a Windows install from hard drive to SSD this weekend - there are a number of steps that can be done beforehand to tighten up the size of the final output. These steps are also useful for virtual machines, but they tend to take quite a while...<p>(1) Defrag - built-in &#x2F; maybe SysInternals contig <a href="http://technet.microsoft.com/en-us/sysinternals/bb897428" rel="nofollow">http:&#x2F;&#x2F;technet.microsoft.com&#x2F;en-us&#x2F;sysinternals&#x2F;bb897428</a><p>(2) Defrag the page file - SysInternals PageDefrag <a href="http://technet.microsoft.com/en-us/sysinternals/bb897426" rel="nofollow">http:&#x2F;&#x2F;technet.microsoft.com&#x2F;en-us&#x2F;sysinternals&#x2F;bb897426</a><p>(3) Zero unused space - SysInternals SDelete <a href="http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx" rel="nofollow">http:&#x2F;&#x2F;technet.microsoft.com&#x2F;en-us&#x2F;sysinternals&#x2F;bb897443.asp...</a><p>(4) Shrink volume (if backup is filesystem-aware, and disk is one large volume) - <a href="http://technet.microsoft.com/en-us/magazine/gg309169.aspx" rel="nofollow">http:&#x2F;&#x2F;technet.microsoft.com&#x2F;en-us&#x2F;magazine&#x2F;gg309169.aspx</a><p>(5) After transfer, expand volume to fit target disk<p>Pretty much any utility automating these steps is acquired by the various virtualization vendors, or heads directly to the enterprise market (kind of like how inexpensive screencast creation software always disappears!).
评论 #6072417 未加载
loser777将近 12 年前
Hmm, I&#x27;m a bit wary of this kind of backup, because it seems like it&#x27;s nontrivial to recover part of your data if half of the backup goes bad. While the old fashioned rsync&#x2F;copy all your files may be less efficient, you&#x27;ll still have whatever it managed to copy if something goes wrong partway through.<p>This reminds be of doing a tar archive of all your files--if the archive is corrupted during that process, what then?
评论 #6072108 未加载
评论 #6072276 未加载
bcoates将近 12 年前
If you want to do something less tricky and low level than dd just remount the drive in question read-only and use tar. (be root to keep permissions, --use-compress-program=pigz)<p>On the restore side, you can just use pv like cat, and don&#x27;t have to provide a size param:<p><pre><code> pv my.img.gz | pigz -d | dd (or hopefully tar xf - instead)... </code></pre> In an ideal world a tool like pv could just look at &#x2F;proc&#x2F;<i>fd</i>&#x2F;fdinfo&#x2F; instead of shuffling all the data through itself but I haven&#x27;t found a tool that clever yet.
WizzleKake将近 12 年前
This is an incredibly naive way of backing up your system.<p>I use rsync to back up certain folders. I&#x27;m OK with re-installing Linux if my hard drive crashes.
评论 #6071558 未加载
Yen将近 12 年前
The author mentions that removed files stick around on disk after being removed, and that this can increase the size of a compressed bit-for-bit copy.<p>They then suggest you can mitigate this by writing zeros to a file before rm&#x27;ing it. However, this is slow in the general case, and doesn&#x27;t help if you&#x27;ve already rm&#x27;d the file.<p>As an alternative, the &#x27;sfree&#x27; utility, available in the debian package &#x27;secure-delete&#x27;, can be used to fill the unallocated portions of a disk with zeroes (or random data).<p>sfree -llz &lt;disk device&gt;<p>will write zeroes to the free areas of a disk. -ll limits it to only one pass over the disk, and -z makes that pass write zeroes, instead of random data.<p>man page: <a href="http://manpages.ubuntu.com/manpages/lucid/man1/sfill.1.html" rel="nofollow">http:&#x2F;&#x2F;manpages.ubuntu.com&#x2F;manpages&#x2F;lucid&#x2F;man1&#x2F;sfill.1.html</a>
评论 #6073812 未加载
jaryd将近 12 年前
On OSX, CarbonCopyCloner works really well :)
sergiosgc将近 12 年前
If you want to backup with this kind of technique, use partimage instead, and do so from a rescue CD. You need a quiescent filesystem for imaging, so it can&#x27;t be under use by the running OS.
评论 #6071204 未加载
rlpb将近 12 年前
Remember that this cannot be run on a live system, since you&#x27;ll get a corrupt image. Thus it&#x27;s more useful for infrequent maintenance tasks than as part of a regular regime.
allgood38将近 12 年前
Hi! Author of this article here,<p>I&#x27;ve done something completely silly. I originally wrote this site on github, but then moved it over to a new host on its own domain and totally forgot about the old one.<p>If you like this article, please check it out here at:<p><a href="http://allgood38.io/a-snapshot-of-your-computer-with-dd-pv-and-gzip-part-1.html" rel="nofollow">http:&#x2F;&#x2F;allgood38.io&#x2F;a-snapshot-of-your-computer-with-dd-pv-a...</a>
jamesmiller5将近 12 年前
At first glance it reminded me of this counter argument which warns about using `dd`, especially on a failing drive.<p><a href="http://rachelbythebay.com/w/2011/12/11/cloning/" rel="nofollow">http:&#x2F;&#x2F;rachelbythebay.com&#x2F;w&#x2F;2011&#x2F;12&#x2F;11&#x2F;cloning&#x2F;</a>
tlongren将近 12 年前
Pigz looks nice. First I&#x27;ve ever heard of it.<p>I just use BackInTime though, like TimeMachine I guess. It&#x27;s really, really useful.<p><a href="http://backintime.le-web.org/screenshots/" rel="nofollow">http:&#x2F;&#x2F;backintime.le-web.org&#x2F;screenshots&#x2F;</a>
评论 #6071956 未加载