How to Fix hd0 Out of Disk Error on Linux

One of the errors Linux users dread more than any other reads something like error: hd0 out of disk. Press any key to continue… at boot time. This error makes it seem as though your boot volume is physically not present in your system. While this does indicate that there has been some sort of massive accounting problem, it isn’t nearly as bad as the verbiage in question might make it sound. Booting from a live USB ISO may be all that you need to recover your main installation and restore the ability to boot from your primary / mounted root partition.

Assuming you’ve been able to restore your file structure with these steps, you’ll need to update your package mangers. Use, for instance, the sudo apt-get update command in Ubuntu or Debian to do so. Damage to the file structure can, in turn, cause damage to the repository lists and therefore make it so that your installation either believes it’s up to date when it’s not or vice versa. Updating and then upgrading your packages will also potentially help to overwrite damaged files with safe pieces of system software.

Recovering From hd0 Out of Disk Errors

On boot time you might find your Linux installation hangs with an error that reads something like error: hd0 out of disk, though the device file and partition number may be different depending on your configuration. This can change if different partitions are damaged, and it might also show the name of a higher-level sd# device rather than a lower-level more classic hd# device file.

While the system will prompt you to push any key to continue, these generally won’t work. At times you can either drop down to the GRUB terminal or an emergency recovery prompt, but often you’ll need to boot from a live CD or USB installation. You could also attempt to boot from another partition on your physical machine if you happen to have a second volume with Linux or FreeBSD installed on it.

If you insert a live USB ISO-written device into one of the slots on your machine, then you’ll probably need to push a specific key when starting your machine to boot from it. This depends on your hardware, but make sure to select removable storage when asked for the type of device you’re booting. You may have received a message before about being in a busybox ash shell if you were able to boot your system somewhat successfully. In either case, you need to get to a prompt and you should make sure you have root access before proceeding. Otherwise, preface each individual command name with sudo before issuing it. You could also try sudo -i, sudo bash, sudo tcsh or sudo busybox ash to get a root shell from the prompt.

You may want to copy your entire ~/ home directory to a removable device, just in case you have serious damage, but you should preform an fsck operation first. We’ll assume that /dev/sda1 is the damaged partition for the sake of discussion, but replace the device file with the correct name of the one on your system. Start with umount /dev/sda1 and then fsck.ext4 -f /dev/sda1 to make sure the file system isn’t damaged. If you have any other partitions you’d like to check, then do so now. You may wish to use e2fsck or fsck.ext3 depending on the file system you were booting. Make sure to always umount the partitions before running fsck.

Multiple kernels competing with each other on the same device might cause this error. In some cases, the fsck command could have fixed the issue, but assuming there’s more issue the following commands to mount portions of the file structure in your live USB environment:

mount /dev/sda1 /mnt

mount –bind /dev /mnt/dev

mount –bind /dev/pts /mnt/dev/pts

mount –bind /proc /mnt/proc

mount –bind /sys /mnt/sys

chroot /mnt

Now you’ll need to run apt-get update, apt-get autoremove and apt-get clean to clean things up. Once again, this could have fixed the issue and you might find that the operating system will now boot properly. If it doesn’t, then try using this to set an environment variable:

UNUSCONF=$(dpkg -l|grep “^rc”|awk ‘{print $2}’)


apt-get remove –purge $UNUSCONF

NEWKERNEL=$(uname -r|sed ‘s/-*[a-z]//g’|sed ‘s/-amd64//g’)



UNUSKERNELS=$(dpkg -l|awk ‘{print $2}’|grep -E $ADDKERNEL |grep -vE $METAKERNEL|grep -v $NEWKERNEL)

Though you might have to change the amd64 references to 386 or i386 and the debian-modules reference to ubuntu-modules if you’re not on pure Debian. Finally run:

apt-get remove –purge $UNUSKERNELS

grub-install –root-directory=/mnt /dev/sda

grub-install –recheck /dev/sda

umount /mnt

Then reboot your system from the primary partition and see if GRUB now works correctly. This will actually install an entirely fresh copy of GRUB on your partition, removing the waste products of any issues of the Linux kernel that you might no longer use. In some cases, you might now receive an entirely different error that has to do with GRUB’s installation being faulty, but this isn’t related to the same problem you were having before and further troubleshooting along these lines may actually turn out to be fruitless.

Should you still have the error upon reboot after running fsck and the kernel cleaning routines, then you may actually have a more serious hardware failure that prevents Linux from starting. Check the connections to your disk, and make sure that the power adapter is attached snugly. This is more of a problem with ancient IDE Molex connectors than it is with SATA and pretty much everything more modern than that. You may also wish to consider the age of your boot volume if you were working with any type of SSD. NAND memory chips eventually wear out, and this may prompt the need to run a badblocks check. A few people might be booting from either an SD card slot or an SD to PATA or SATA adapter. These cards can sometimes slip out and humidity can wreak havoc on the contacts, so you may wish to shut the system down, eject the card and reposition it before trying again.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Fix hd0 Out of Disk Error on Linux

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested