1

I’m running a Pi2 within a Western Digital PiDrive connected over USB 2 booting into buster. So I boot off a hard drive not the SD card.

The drive appears to have corrupted itself. The box boots fine, but after a while it throws an error and sets the file system to read only. I can read the file system fine, just can’t write to it.

I would like to create an image of the drive contents, which are less than 1Gb in total, while the box is up and running, avoiding the bad sectors, and then reinstall the image having reformatted or replaced the faulty 256Gb WD hard drive. I’ve run fsck numerous times to no avail, so more drastic action seems to be required.

I suspect dd or something similar would suffice, but my UNIX sys admin skills don’t run that far. Is it possible? Could I halt the box into single user mode and image the system on to a USB stick, boot off the stick, reformat the drive, reinstall buster, boot to the new install, set the file system to read only, and then re image the old drive on the usb back to the original drive? All without writing to the faulty drive, of course.

1 Answer 1

0

The simple answer is to restore from the backup you made while your system was still running. (I know 99% of users only think about backup AFTER it fails.)

Any imaging system (dd etc) will only reproduce any errors.

Assuming the storage medium still works you can always mount on a running Linux system and copy files.

There is absolutely no point in trying to restore the OS - just use a new OS, install the applications you need and copy those of YOUR files which are readable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.