On 08/19/2014 05:35 AM, John Andersen wrote:
Smart throwing errors on my opensuse laptop drive. Occasional long pauses. The old drive is still bootable and runs but its clearly on its way out.
Have new drive ready to install in an external USB enclosure.
I want to see if I can just get everything off the failing drive onto the new drive while preserving the entire layout of partitions etc. Old drive 320Gig, New Drive 500Gig. (That might have been a mistake).
I can either do this booting from the old drive or I have a bootable DVD Knopix around.
Is there any way to DD this drive across and take advantage of the full size of the newer drive?
As Felix already mentioned, you could create the same partitioning on the new drive and then do the copying per partition. This will save you the time or trouble to copy the swap partition as you can easily run mkswap(8) on the new drive's swap partition. Then, a rescue system like Knoppix is probably better than booting into the old, failing disk's system because that would write onto the old disk and so stress it unnecessarily. Using a such a live system also has the advantage that you can mount the file system(s) on the old drive read-only which is always a good idea in such a case. Regarding the copying itself: the success will depend on how many and how big the bad blocks are on the old drive. And there's another argument: with block-level copying methods like dd and friends you will have zeroed blocks of data on the new file system where reading on the old failed without knowing which files are corrupted. This may be an argument for using plain cp(1) which would give you an error diagnostic per failing file. OTOH, the latter may be slower (which should never be an argument while rescuing). I'll come to such a file-level option later again. Now regarding dd(1): as it would usually exit on the first bad read(), you'll need at least the following options (as mentioned similarly in the Texinfo manual [1], too): # Rescue data from an (unmounted!) partition of a failing disk. dd conv=noerror,sync iflag=fullblock < /dev/sda1 > /dev/sdb1 [1] http://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html Furthermore, you may want to think about the block size parameter: while it would be convenient to use a huge block size like "bs=1G" on healthy drives for better speed, this would mean that if only the reading of one physical block from the old disk fails, then the rest of the whole 1G on the new drive may be filled with Zeroes, ugh. Therefore, I'd leave the quite small default for the block size on the reading side while doing some buffering on the writing side: dd ... obs=32M ... Finally, nothing prevents you from trying to get the names of the corrupted files afterward - by mounting both sides (the old one probably read-only), and issuing something like rsync -n -Haix --delete /mnt/old-partition1/. /mnt/new-partition1/. with (or maybe later without) the dry-run option -n. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org