12

I'm a user of Oracle Virtualbox on Ubuntu. And I used to copy vdi files as a kind of backup. Previously I did this (copying vdi file and then copying it back) many times without any problem.

But today I experienced this error

VirtualBox VMs/win_7$ cp ../../Bkps/win_7.vdi .
cp: error reading ‘../../Bkps/win_7.vdi’: Input/output error
cp: failed to extend ‘./win_7.vdi’: Input/output error

I googled for this a little but from the advices on similar problems I undersood nothing unfortunately. Could anyone suggest how to solve this, please?

The output from the dmesg is, (and I understand nothing from it)

[ 2347.982876] ata1.00: exception Emask 0x0 SAct 0x1900406f SErr 0x0 action 0x0
[ 2347.982887] ata1.00: irq_stat 0x40000008
[ 2347.982895] ata1.00: failed command: READ FPDMA QUEUED
[ 2347.982908] ata1.00: cmd 60/08:70:d0:da:f4/00:00:2e:00:00/40 tag 14 ncq 4096 in
[ 2347.982908]          res 41/40:08:d0:da:f4/00:00:2e:00:00/00 Emask 0x409 (media error) <F>
[ 2347.982915] ata1.00: status: { DRDY ERR }
[ 2347.982919] ata1.00: error: { UNC }
[ 2348.395657] ata1.00: configured for UDMA/133
[ 2348.395727] sd 0:0:0:0: [sda] Unhandled sense code
[ 2348.395733] sd 0:0:0:0: [sda]  
[ 2348.395737] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2348.395741] sd 0:0:0:0: [sda]  
[ 2348.395745] Sense Key : Medium Error [current] [descriptor]
[ 2348.395752] Descriptor sense data with sense descriptors (in hex):
[ 2348.395764]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 
[ 2348.395770]         2e f4 da d0 
[ 2348.395772] sd 0:0:0:0: [sda]  
[ 2348.395774] Add. Sense: Unrecovered read error - auto reallocate failed
[ 2348.395775] sd 0:0:0:0: [sda] CDB: 
[ 2348.395776] Read(10): 28 00 2e f4 da d0 00 00 08 00
[ 2348.395781] end_request: I/O error, dev sda, sector 787798736
[ 2348.395792] ecryptfs_decrypt_page: Error attempting to read lower page; rc = [-5]
[ 2348.395795] ata1: EH complete
[ 2348.395797] ecryptfs_readpage: Error decrypting page; rc = [-5]
[ 2351.264987] ata1.00: exception Emask 0x0 SAct 0x7f80400 SErr 0x0 action 0x0
[ 2351.264998] ata1.00: irq_stat 0x40000008
[ 2351.265005] ata1.00: failed command: READ FPDMA QUEUED
[ 2351.265019] ata1.00: cmd 60/08:50:d0:da:f4/00:00:2e:00:00/40 tag 10 ncq 4096 in
[ 2351.265019]          res 41/40:08:d0:da:f4/00:00:2e:00:00/00 Emask 0x409 (media error) <F>
[ 2351.265025] ata1.00: status: { DRDY ERR }
[ 2351.265029] ata1.00: error: { UNC }
[ 2351.403371] ata1.00: configured for UDMA/133
[ 2351.403425] sd 0:0:0:0: [sda] Unhandled sense code
[ 2351.403426] sd 0:0:0:0: [sda]  
[ 2351.403428] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2351.403429] sd 0:0:0:0: [sda]  
[ 2351.403430] Sense Key : Medium Error [current] [descriptor]
[ 2351.403433] Descriptor sense data with sense descriptors (in hex):
[ 2351.403434]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 
[ 2351.403439]         2e f4 da d0 
[ 2351.403442] sd 0:0:0:0: [sda]  
[ 2351.403444] Add. Sense: Unrecovered read error - auto reallocate failed
[ 2351.403445] sd 0:0:0:0: [sda] CDB: 
[ 2351.403446] Read(10): 28 00 2e f4 da d0 00 00 08 00
[ 2351.403451] end_request: I/O error, dev sda, sector 787798736
[ 2351.403463] ecryptfs_decrypt_page: Error attempting to read lower page; rc = [-5]
[ 2351.403466] ecryptfs_readpage: Error decrypting page; rc = [-5]
[ 2351.403470] ata1: EH complete

Any help is greatly appreciated, thank you in advance

11
  • Maybe the disk the vdi file is on if full? Try df -h Aug 11, 2014 at 10:00
  • Oh, wait - are you doing all this inside virtualbox, or outside? Aug 11, 2014 at 10:01
  • @VolkerSiegel I do this outside, on my host system. The partition, where the copy is stored and where I try to make a copy has 280GB available, so it is more than enough, as I said I did this operation already many times. I suppose that this can be an error of the HDD
    – d.k
    Aug 11, 2014 at 10:05
  • What is the filesystem on that partition of /dev/sda? (mount | grep /dev/sda) Aug 11, 2014 at 10:55
  • @VolkerSiegel the output is /dev/sda5 on /home type ext4 (rw)
    – d.k
    Aug 11, 2014 at 11:17

3 Answers 3

11

For me, I got this error when trying to copy disk images that totaled something like 128GB. cp was trying to load the whole thing in memory in order to rewrite it back out and that obviously won't work, so it has to be done in chunks. The best way I've found to chunk the file is to force it through ssh.

scp user@localhost:/path/to/source /path/to/dest

You have to use user@localhost; omitting it will revert to cp-like behavior.

3
  • This is actually a pretty nifty trick. I have a disk that's on the way out and I was getting Input/Output errors while trying to copy data off of it. scp saved the day. May 12, 2021 at 13:34
  • This is wonderful. Never would've come up with it on my own, but it worked on the first try for a 480 GB disk image I was having trouble with. Jan 26, 2022 at 0:24
  • I had to enable "Remote Login" under the "Sharing" Settings, first. After that, it worked perfectly! Jul 20, 2022 at 5:21
8

If this is not a "disk" inside a virtualbox, but the real physical disk where the vm images are stored on, that looks pretty bad.

There were read errors, on /dev/sda.
There is an automatic handling by marking a disk block as bad block forever, and use a different one instead.
For this to work, the harddisk needs to read the data one single more time, maybe trying a couple of hundred reads.
But the disk gave up on this:

"Add. Sense: Unrecovered read error - auto reallocate failed"

There are really bad errors on the disk - it's just not yet clear whether they are in one location only, or spread, and whether they increase with time.

The harddisk may fail very soon,
like "just now".
Or next week, or not at all.

If it does ok on a e2fsck test, you cann still not use it for anything important.

As soon as e2fsck confirms there are medium errors, best is to just replace it.

Otherwise, make backups as soon as possible,
boot a live CD or so (or find a way to unmount/not mount /home),
and check for bad blocks, like by

sudo e2fsck -c -v /dev/sdXN

Take into account that on a larger mechanical hard disk, checking for bad blocks may take lots of time, between hours and maybe a day or two. That is in part because the program needs to check each disk block separately, and take care of problems separately too. But also, if the disk is giving errors when reading, there are lots of retries on multiple levels before e2fsck even knows there is a problem. For each disk block.

It may be the right thing to just run e2fsck in auto-repair mode and leave the computer alone for a while:

sudo e2fsck -p -c -v /dev/sdXN

See ubuntuforums: Random freeze and "Unrecovered read error" in /var/log/messages for details.

7
  • I did not understand what did you mean with "the real physical disk". This is not a real disk, this is a file which is Virtualbox virtual drive
    – d.k
    Aug 11, 2014 at 10:30
  • Ok, some questions to confirm, I may be wrong: The file win_7.vdi is a vm image, right? And it is outside any vms, right? I mean the file win_7.vdi is on a real disk - right? The dmesg output is from outside the vm, right? In this case, the errors in the dmesg log are on a real harddisk /dev/sda. Aug 11, 2014 at 10:34
  • yes, "right" to all your questions
    – d.k
    Aug 11, 2014 at 10:35
  • 1
    Good - but bad for the disk... can you just replace it? It may fail very soon, like "just now". Or next week, or not at all. If it does ok on a e2fsck test, you cann still not use it for anything important. Aug 11, 2014 at 10:39
  • And, by the way, is your /home encrypted? Aug 11, 2014 at 11:40
2

The sectors of your hard disk got corrupted. DRDY ERR - Device Ready Check Error. UNC - Uncorrectable.

Due to various reasons such as abrupt shut down during extensive write, High temperature, Read write operations carried out and the quality of hard disk plays a major role in this case.

Once a sector got corrupted and if the kernel tries to access those sectors then you will get this error.

You can use seatools, to recover from this error temporarily. But will not be to fix this issue forever, It may occur again some times later.

If you are lucky, then it will not reoccur for several days.

Better backup the data to a new hard disk and replace the hard disk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .