Code: Select all
dd if=/dev/sda of=/dev/sdb conv=noerror status=progress
Code: Select all
dd if=/dev/sda of=/dev/sdb conv=noerror status=progress
as in format it? i don't think so..
Code: Select all
root@porteus:/home/guest# ./dd.sh
brw-rw---- 1 disk 8, 0 May 14 15:09 /dev/sda
brw-rw---- 1 disk 8, 16 May 15 00:33 /dev/sdb
Copy sda to sdb?
80025954816 bytes (80 GB, 75 GiB) copied, 20533 s, 3.9 MB/s
dd: writing to '/dev/sdb': No space left on device
156301489+0 records in
156301488+0 records out
80026361856 bytes (80 GB, 75 GiB) copied, 20533 s, 3.9 MB/s
root@porteus:/home/guest#
Code: Select all
#!/bin/bash
# Color definitions # ups.sh
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Bold Red
txtgreen=${txtbld}$(tput setaf 2) # Bold Green
txtcyan=${txtbld}$(tput setaf 6) # Bold Cyan
rst=$(tput sgr0) # Reset
function redpswd() {
echo -E "$1" $txtred
}
function cyan() {
echo -E "$1" $txtcyan
}
if [ `whoami` != "root" ]; then
cyan "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
ls -g /dev/sda
ls -g /dev/sdb
echo Copy sda to sdb?
read
dd if=/dev/sda of=/dev/sdb conv=noerror status=progress
yes, it would seem so..
although here: https://wiki.archlinux.org/index.php/Dd ... nd_restore seems to state that dd can clone multiple partitions in one go..If you wanted to duplicate an existing drive to another, you would obtain a drive of the same (or larger) size. Assuming the drive to copy is /dev/sda and the destination drive is /dev/sdb, first use fdisk to recreate the appropriately-sized partitions, then use dd to do the actual cloning:
# sfdisk -d /dev/sda | sfdisk /dev/sdb
# fdisk -l /dev/sda; fdisk -l /dev/sdb
Compare the output of the two fdisk commands and make sure the partitions on /dev/sdb match those on /dev/sda. Once this is done, you can copy each partition using:
# dd if=/dev/sda of=/dev/sdb bs=446 count=1
# dd if=/dev/sda1 of=/dev/sdb1
# dd if=/dev/sda2 of=/dev/sdb2
...
The first dd call copies the MBR from the first disk to the second. This will allow the second disk to be booted, when it replaces the first. The first 446 bytes are copied with this command; that is the boot code we need.
Yes, that appears to be the case.ncmprhnsbl wrote: ↑15 May 2019, 23:17a key point is that the destination drive must be the same or larger size..