Other dd to smaller disk

Can anyone tell me what happens when

dd if=/dev/da0 of=/dev/da1

if da1 is smaller then da0 but is greater than the space used on da0? Does da1 contain a usable copy of da0?
 
Can anyone tell me what happens [...] if da1 is smaller then da0
dd will just stop copying when reaching the end of the target
Does da1 contain a usable copy of da0?
Sure, a truncated one. Although "usable" would most likely be defined above the block layer. And with a typical filesystem, it's very likely there was crucial data in the truncated part, so, most likely: no.
 
probably not
recreate the partitions and dump/restore the fs on them
It most definitely does not work, just tried it and it messed up the boot sector on the target disk.

I'm now trying to use dump to copy the main partition after partitioning and formatting the target, but can't figure how to run dump. I tried

Code:
mnt /dev/ada1p2 /mnt
dump -f /dev/ada0p2 /mnt

but dump says /mnt unknown filesystem
 
Eventually found an example of dump() here
Code:
# mount /dev/da0s1f /mnt
# dump -C16 -b64 -0uanL -h0 -f - /usr | (cd /mnt && restore -ruf -)

Not easily remembered and I'm not sure what all the command line switches do, but I'll give it a go
 
It most definitely does not work, just tried it and it messed up the boot sector on the target disk.
That makes no sense. The boot stuff (MBR, partition table and boot partition) are at the beginning of the disk, and should have been copied, no problem.
 
if da1 is smaller then da0 but is greater than the space used on da0?
It is almost impossible to find, with zfs for sure but even with ufs.
They are not NTFS or FAT-like filesystems
 
Back
Top