If I have a file abc.gz, size 83456k, I would like to use the DD command to achieve the following backup results: First, the backup is divided into three parts, The first part is the backup file abc.gz the first 10000k, the second part is divided into the middle 70000k, the last backup behind the 3456k.
The backup method is as follows three commands:
DD if=abc.gz OF=ABC.GZ.BAK1 bs=1k count=10000
DD if=abc.gz OF=ABC.GZ.BAK2 bs=1k skip=10000 count=70000
DD if=abc.gz OF=ABC.GZ.BAK3 bs=1k skip=80000
The recovery method is as follows:
DD IF=ABC.GZ.BAK1 of=abc.gz
DD IF=ABC.GZ.BAK2 of=abc.gz bs=1k seek=10000
DD If=abc.gz.bak3 of=abc.gz bs=1k seek=80000
Then you look at the recovered files will be the same as your original file, indicating that the backup was successful!
Explanation: Skip=xxx is the backup when the part after the if is the original file skip the number of blocks before starting the backup, Seek=xxx is at the time of the backup of the part of the target file skip the number of blocks before you start writing.
DD Skip and seek parameter understanding (RPM)