I am trying to verify a backup that I made using the following command:dd if=/dev/sda of=/dev/sdc2I backed up the contents of /dev/sda (internal hard drive) to/dev/sdc2 (external backup drive, connected via USB), however/dev/sdc2 (the partition where /dev/sda is being backed up into)is slightly larger than /dev/sda.I cannot make /dev/sdc2 the size of /dev/sda because the size inbytes of /dev/sda is not divisible by 4096, which is the sector sizeon drive /dev/sdc.I want to know if diff (the Unix command) will let you assume the sizeof /dev/sdc2 to be the size of /dev/sda (only compare the first xbytes, (x being the size of /dev/sda) of /dev/sdc2)The reason I want to verify this is because, when I was doing runningdd (and then diff /dev/sda /dev/sdc2), I got errors in the systemlog.I ran diff /dev/sda /dev/sdc2 and it said that the devices differ,probably because /dev/sdc2 is larger than /dev/sda.The errors (which repeated themselves every once in a while, withvarying numbers) looked like this:ata5.00: exception Emask 0x50 SAct 0x0 SErr 0x280900 action 0x6 frozenata5.00: irq_stat 0x08000000, interface fatal errorata5: SError: { UnrecovData HostInt 10B8B BadCRC }ata5.00: failed command: READ DMAata5.00: cmd c8/00:00:e0:57:f9/00:00:00:00:00/e9 tag 4 dma 131072 in         res 50/00:00:df:57:f9/00:00:09:00:00/e9 Emask 0x50 (ATA bus error)ata5.00: status: { DRDY }ata5: softreset failed (device not ready)The computer I am doing this on is running the ISO version (installer)of Arch Linux and is not connected to the internet at the moment (willbe later). Should I try a different Linux distribution?
Compare two files, while overriding second file's size
backup;dd;diff
Perhaps cmp is adequate in this case:SYNOPSIS       cmp [OPTION]... FILE1 [FILE2 [SKIP1 [SKIP2]]]DESCRIPTION       Compare two files byte by byte. (...)       -n, --bytes=LIMIT              compare at most LIMIT bytesYou will want to pass, as an argument to cmp -n, the size in bytesof the source device, which blockdev --getsize64 can compute:cmp --bytes=$(blockdev --getsize64 /dev/sda) /dev/sda /dev/sdc2Note, however, that the error messages you pasted seem to indicateactual read errors, so it's likely that you are facing an actualproblem with your data, not just one related to how diff operates.