惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
J
Java Code Geeks
小众软件
小众软件
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
量子位
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
L
LangChain Blog

博客园 - 月の祭司

eMule需要备份的文件 OpenDNS,独特的免费DNS 用MeGUI压制720x480 MP4视频,详细教程[面向有一定基础者] [转载]avs讲解及其在rmvb压制中的合理运用 - 月の祭司 - 博客园 AVS脚本参数 - 月の祭司 - 博客园 VS2008 download ed2k links Vista和Linux共存的2种方法 删除 Windows Event Viewer 中不需要的Event ArchLinux Gnome Terminal 优盘中文问号的解决方法 [转载]dd command of Linux vi中去掉“^M” GNU EMACS字体设置,基本上可以随心所欲 LInux下Mplayer字幕乱码,日文字体部分乱码解决方案 Arch Linux下 让MPlayer用上CoreAVC1.7.0.0解码器 Ubuntu 声卡独占解决方法 [转载]搞定amd64 8.04下面mldonkey自动退出问题(段错误) Ubuntu8.04系统优化 Ubuntu 8.04 Flash中文方块儿解决办法 Install Opera&Config Font on Ubuntu 64bit
[转载]Image Your Hard Drive using dd - 月の祭司
月の祭司 · 2008-06-25 · via 博客园 - 月の祭司

I have backed up my system to an external ximeta drive using "dd" and the well-known linux live cd distribution, Knoppix to boot from. Below are the steps in brief:

  1. Boot from the live cdrom distribution.
  2. Switch to root.
  3. Make sure NO partitions are mounted from the source hard drive.
  4. Mount the external HD.
      # mount -t vfat /dev/sda1 /mnt/sda1
  5. Backup the drive.
      # dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c  > /mnt/sda1/hda.img.gz

    "dd" is the command to make a bit-by-bit copy of "if=/dev/hda" as the "Input File" to "of=/mnt/sda1/hda.img.gz" as the "Output File". Everything from the partition will go into an "Output File" named "hda.img.gz". "conv=sync,noerror" tells dd that if it can't read a block due to a read error, then it should at least write something to its output of the correct length. Even if your hard disk exhibits no errors, remember that dd will read every single block, including any blocks which the OS avoids using because it has marked them as bad. "bs=64K" is the block size of 64x1024 Bytes. Using this large of block size speeds up the copying process. The output of dd is then piped through gzip to compress it.

  6. To restore your system:
      # gunzip -c /mnt/sda1/hda.img.gz | dd of=/dev/hda conv=sync,noerror bs=64K 
  7. Store extra information about the drive geometry necessary in order to interpret the partition table stored within the image. The most important of which is the cylinder size.
      # fdisk -l /dev/hda > /mnt/sda1/hda_fdisk.info

Notes:

One of the disadvantages of the dd method over software specifically designed for the job such as Ghost or partimage is that dd will store the entire partition, including blocks not currently used to store files, whereas the likes of Ghost understand the filesystem and don't store these unallocated blocks. The overhead isn't too bad as long as you compress the image and the unallocated blocks have low entropy. In general this will not be the case because the emtpy blocks contain random junk from bygone files. To rectify this, it's best to blank all unused blocks before making the image. After doing that, the unallocated blocks will contain mostly zeros and will therefore compress down to almost nothing.

Mount the partition, then create a file of zeros which fills the entire disk, then delete it again.

# dd if=/dev/zero of=/tmp/delete.me bs=8M; rm delete.me

References:

  1. backup-hard-disk-partitions
  2. linux_loopback
  3. imagedrive

 posted on 2008-06-25 17:12  月の祭司  阅读(445)  评论()    收藏  举报