dd
Disk cloning is nothing but a mere process of creating an image of an entire disk. This can be useful for copying disks, backups, recovery and more. The dd command is easy to use tool for making such clones.
dd if=/dev/source of=/mnt/destination bs=64k conv=noerror,sync
bs=64k : Sets the block size to 64k. You can use 128k or any other value.
conv=noerror : Tell dd to continue operation, ignoring all read errors.
sync : Add input blocks with zeroes if there were any read errors, so data offsets stay in sync.
# dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync
if you want to put remote place
# dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c | ssh vivek@server1.cyberciti.biz dd of=centos-core-7.gz
disk image
#dd if=/dev/INPUT/DEVICE-NAME-HERE conv=sync,noerror bs=64K | gzip -c > /path/to/my-disk.image.gz
restore the image
# gunzip -c IMAGE.HERE-GZ | dd of=/dev/OUTPUT/DEVICE-HERE
# gunzip -c centos-core-7.gz | dd of=/dev/da0
if you want to know the status of progress let's add like this
# dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync status=progress
-----------------------------------------------------------------------------
[root@ADV-CACTISERVER sdb]# dd if=/dev/sda conv=sync,noerror bs=1024k | gzip -c > /mnt/sdb/centos.gz
30720+0 records in
30720+0 records out
32212254720 bytes (32 GB) copied, 1311.88 s, 24.6 MB/s
---------------------------------------------------------------------------
Disk cloning is nothing but a mere process of creating an image of an entire disk. This can be useful for copying disks, backups, recovery and more. The dd command is easy to use tool for making such clones.
dd if=/dev/source of=/mnt/destination bs=64k conv=noerror,sync
bs=64k : Sets the block size to 64k. You can use 128k or any other value.
conv=noerror : Tell dd to continue operation, ignoring all read errors.
sync : Add input blocks with zeroes if there were any read errors, so data offsets stay in sync.
# dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync
if you want to put remote place
# dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c | ssh vivek@server1.cyberciti.biz dd of=centos-core-7.gz
disk image
#dd if=/dev/INPUT/DEVICE-NAME-HERE conv=sync,noerror bs=64K | gzip -c > /path/to/my-disk.image.gz
restore the image
# gunzip -c IMAGE.HERE-GZ | dd of=/dev/OUTPUT/DEVICE-HERE
# gunzip -c centos-core-7.gz | dd of=/dev/da0
if you want to know the status of progress let's add like this
# dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync status=progress
-----------------------------------------------------------------------------
[root@ADV-CACTISERVER sdb]# dd if=/dev/sda conv=sync,noerror bs=1024k | gzip -c > /mnt/sdb/centos.gz
30720+0 records in
30720+0 records out
32212254720 bytes (32 GB) copied, 1311.88 s, 24.6 MB/s
---------------------------------------------------------------------------
Add new disk
[root@ADV-CACTISERVER ~]# mkfs.ext4 /dev/sdc
mke2fs 1.41.12 (17-May-2010)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2293760 inodes, 9175040 blocks
458752 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
280 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
---------------------------------------------------
#gunzip -c /mnt/sdb/centos.gz | dd of=/dev/sdc
it take a while
after that sdb can able to boot
after that sdb can able to boot
No comments:
Post a Comment