6

使用dd命令备份磁盘

 1 year ago
source link: https://zhangyiming748.github.io/2022/09/01/use_dd_clone_disk/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用dd命令备份磁盘

Posted by Zen on September 1, 2022

磁盘➡️磁盘

$ sudo dd if=/dev/sda of=/dev/sdb

dd命令是按照文件块操作,如果不指明块的大小和数量,dd命令会对全部硬盘进行复制,并不会跳过磁盘未使用的空间.一定要确保目标文件比原来的磁盘文件大.

磁盘➡️镜像

$ sudo dd if=/dev/sda of=~/disk1.img

需要在livecd环境操作,不要把本机硬盘备份到本机,那样只会无限递归

磁盘➡️压缩镜像

$ sudo dd if=/dev/sda | gzip > disk.img.gz
$ sudo dd if=/dev/sda | bzip2 > disk.img.bz2

磁盘➡️磁盘

$ sudo dd if=/dev/sda of=/dev/sdb

镜像➡️磁盘

$ sudo dd if=~/disk1.img of=/dev/sda

压缩镜像➡️磁盘

$ sudo gzip -dc /disk.img.gz | dd of=/dev/sda

不过既然是烧写磁盘这种小事,完全可以使用现成的程序来做,比如balenaEtcher,就像最终幻想已经安装在PC上,蒂法穿什么还不是我说了算?

显示dd进度

使用progress命令


0 comments

Be the first person to leave a comment!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK