Typically would use dd , but just got introduced to fallocate from co-worker.. Â (Thanks Adam!), which creates file in far less time.
Old method:
dd if=/dev/zero of=bigfile bs=1024 count=2080000 Â Â (~2GB file)
New Method:
fallocate -l 2G bigfile
Typically would use dd , but just got introduced to fallocate from co-worker.. Â (Thanks Adam!), which creates file in far less time.
Old method:
dd if=/dev/zero of=bigfile bs=1024 count=2080000 Â Â (~2GB file)
New Method:
fallocate -l 2G bigfile
ddrescue and dd_rescue are different. Â Biggest difference is with dd_rescue you can pipe the output over SSH to another host. Â This is why I prefer using dd_rescue more… However when a disk is having issues, it’s best to use ddrescue as it will make every possible attempt to retrieve the data off that damaged disk…
dd_rescue /dev/sda1 – | bzip2 > /some/path/filename.bz2
dd_rescue /dev/sda1 – | ssh root@somehost ” cat – > /some/path/filename.img”
Backup MBR record — assuming your first disk is sda.
dd if=/dev/sda of=backup-sda.mbr count=1 bs=512
Backup partition setup info
sfdisk -d /dev/sda > backup-sda.sf
To Restore, just do the complete opposite (no count,bs)
dd if=backup-sda.mbr of=/dev/sda
Restore partitions just as simple (no -d)
sfdisk /dev/sda < backup-sda.sf
Was in a little jam today and we needed to take backups of a couple of systems. The problem was the local drives didn’t have enough space to take a full disk image. This system was also failing to mount a file system over NFS due to some firewall issues. I had my mind set on taking down the hosts and either using partimage or clonezilla, which I know for sure would have worked. I’m sure you don’t have to use root and could use unpriv’d user with sudo. I’ve used this with tar a bunch of times and was quite amazed when dd worked with it.
$ sudo dd if=/dev/cciss/c0d0 | ssh root@backupserver 'dd of=/some/backup/path/disk.img'
How you can dd a image file directly from within a tar.gz archive.
$ sudo tar xzOf filename.tar.gz | dd of=/dev/sdb bs=1M
How to dd an image from one host and pipe over ssh to remote host
|
1 |
$ sudo tar xzOf filename.tar.gz | ssh root@remoteshost "dd of=/dev/sdb bs=1M |
-O = extract files to standard out
How to create a tar.gz from a directory and pipe over ssh
|
1 |
$ sudo tar zcvf - whateverdirectory | ssh root@backupserver "dd of=/some/backup/path/filename.tar.gz" |