Linux/Backup: Difference between revisions

From Wiki
Line 54: Line 54:
</blockquote>
</blockquote>


or
:: or


<blockquote>
<blockquote>
<pre>
<pre>
watch -n N kill -USR1 `pidof dd`  
watch -n N kill -USR1 `pidof dd`  
</pre>
</blockquote>
* pv
<blockquote>
<pre>
dd if=/dev/sda | pv | dd of=image.dd
pv -s 60G    -> for estimate
</pre>
</pre>
</blockquote>
</blockquote>

Revision as of 15:11, 29 November 2012

DD

Backup

  • simple backup to image file
dd if=/dev/sda | gzip > image.dd.gz
  • gzip image without dd
gzip -c < /dev/hda1 > /tmp/partition_image.gz
  • bootloader
dd if=/dev/sda of=bootloader.img bs=446 count=1
  • MBR + partitiontable
fdisk -lu
dd if=/dev/sda of=mbr.img bs=512? count=1? 63?

Backup over network

  • Target
netcat -l 5555 | dd of=image.dd.gz


  • Source
dd if=/dev/sda | pv | pigz --best | netcat $TargetIP 5555

Status

  • dd status
while /bin/true; do sleep 5; kill -USR1 `pidof dd`; done
or
watch -n N kill -USR1 `pidof dd` 
  • pv
dd if=/dev/sda | pv | dd of=image.dd

pv -s 60G    -> for estimate

Loop

  • mount image as loop
mkdir /mnt/loop
mount -o loop image.dd /mnt/loop
umount /mnt/loop



other

  • dd random
dd if=/dev/random bs=1M count=256 | gzip >./256-MB-random-data.bin

Links