I feel this answer should be here for anyone who are experience failing disks.
The best way to approach a disk that is failing is to detach it carefully from power source and give it to the expensive guys. If you are impatient or feeling lucky, the next best thing is to create a copy of it on block level like this:
- Boot from live CD
- Create a mounting point:
mkdir /mnt/mybigdisk
- Mount another big disk that has space for a single file that is the full size of the entire broken disk:
mount /dev/mybigdisk /mnt/mybigdisk
- While the broken disk is NOT mounted, copy the partition(s) you want to keep like this:
cat /dev/broken_partition1 > /mnt/mybigdisk/part1
- Un-mount and shutdown, removing broken disk (it should be kept un-attached and not rattled about for safe keeping).
Boot into your favorite OS and mount your big disk again:
mount /dev/mybigdisk /mnt/mybigdisk
Create a mounting point for where you want to try to mount the copy of bad partition:
/mnt/my_broken_partition_copy
- Proceed to mount the copy of the broken partition from file using loop device like so:
mount -o loop /mnt/mybigdisk/part1 /mnt/my_broken_partition_copy
NOTE: If the file-system is too damaged, you may not be able to mount without repairing it.
NOTE: If you want to keep the whole disk, or if partition table is screwed, you can also do this on the entire disk. Just swap out /dev/broken_partition1 with /dev/broken_disk1 in instructions above (and mounting the loop device will be a little more complicated after).
NOTE: Even if the file-system is completely broken, you can still dig out data from this block-level copy using all kinds of un-delete/forensics software. Here is a list. That is why it is a good way to go about.
Why is this the next best thing?
Mencahical disks (I am assuming your disk is mechanical, if not it would porbably just not work at all) have a tiny arm inside that moves around to read the data from your disk. If it is somehow broken, then moving this arm might have adverse effects.
The least amount of movement is to read simply the whole disk linearly. That way the arm does not need to bounce around looking for blocks in random order.
Also, in case some areas are "more broken" than others, relying on the metadata of the file-system will not work. It will just retry, fail or do other things that may have adverse effects (move around the arm a lot).
Things to remember:
- You should not mount broken disk as it risks breaking the file system. If you MUST mount them, at least mount read-only.
- Keep broken disks attached to power as little as possible. Keep disk completely still, any sudden movement may make it worse.
- If it starts making bad noises, detach from power immediately.
I hope this is useful.
Error splicing file: Input/output error.
. – phagento Sep 05 '21 at 02:59