dd to smaller partition gives corrupt superblock or partition table
An external hard disk recently started failing, so I bought a new one and partitioned it at approximately the same sizes, although a few turned out slightly smaller. The old partitions were nowhere near full.
I copied the old partitions one by one using dd: Quote:
Quote:
Another option seems to be to start over and simply copy the whole disk with dd if=/dev/sda of=/dev/sdb; will this work even if the new disk is a different brand (but approx. same size) and has different sector sizes etc.? |
"dd" writes every block that it can read, even if it is in error. There are much better alternatives - ddrescue for example.
What you have done is truncate the filesystem - check the arithmetic in the messages you cited above. This is never going to work - ensure the target partition is at least as big as the source, or use a file-aware tool that will only copy the used portiions of the filesystem. Copying the whole disk may mess with the architecture of the target disk - less of an issue these days, but I don't ever do it; partition by partition gives much better control over the whole affair. |
Thanks for your reply. I understand that I should stick to copying partition-by-partition.
The problem with using a file-aware tool (I assume you mean something like cp -R) is that because of the disk problems, I have trouble mounting the old file systems. So I have two questions:
|
Truncating the file system invalidates it - you (effectively) lose the lot, not just a bit. After that is forensic recovery - slooooow and indefinite.
Seems you bought a second disk of the same (FSVO "same") size. Newer tools align new partitions differently, especially on the newer devices with bigger physical blocks. This might explain why you can't allocate all the partitions the "same" (FSVO ...) size. If it was me, I would work on just the partition that could give back the most space. Get it across to the new disk using a larger size, fix the filesystem, shrink it to release space, then shrink the partition to match (gparted is good for this), then work on the other partitions on the now larger than strictly required free space. Recovery is always more work simply restoring from a current backup. |
Thanks again. I'll start over with partitions that are large enough. So, to summarize my understanding of your suggestion:
|
Looks like a plan.
|
All times are GMT -5. The time now is 02:29 PM. |