Recently, my Ubuntu server had a disk failure, after a LiveCD & fsck.ext4, it seems many inodes are lost. Most of them should be program files of installed apt packages.

Before I'm going to reinstall the whole system, I need to reboot the server and run some server applications to backup some data&configurations. And, sure enough, I couldn't boot the server again because some files are lost.

I think something like apt-cache might remember those program files installed from deb packages. I want it scan over the disk and found out which program files are missing, and then refetch them from the ubuntu repository.

This may just look like the Windows sfc utility, which just re-copy all incorrect versioned system files from the CDROM. But I'm not sure if aptitude support this kind of recovery.

  • If the system is that badly broken, do you really want to trust it to try and recover data? What services do you need to start to actually recover data from? On a *nix system most things are just files, if the services aren't running you can probably just rsync everything you want off to another location, so you can rebuild the system. – Zoredache Jul 22 '11 at 8:46
  • 1
    BTW, see this link the procedure described looks like it should do what you are asking for. – Zoredache Jul 22 '11 at 8:49
  • Yes, I've backed up all the data files already. But the installation took a long time, there are a lot of services which need a lot of configuration. All of these may take several days hard work. And, though I'm already began to prepare the second server, if it is possible I want to let the faulty server still provide service. Though it's dangerous, but I'm going to take the risk. – Xiè Jìléi Jul 22 '11 at 8:58

You can force packages to reinstall using apt-get install --reinstall <packages>; the problem is that if you can't run apt-get on the machine, you can't do that, and it sounds like you might be just that broken.

Consider this failure an object lesson in maintaining good risk management and disaster recovery plans, installation and setup documentation, automated build practices (where cost-effective), and superlative backups.

  • Automated build practices sounds great, but apps like Archiva and Hudson, there isn't command line utilities like trac-admin, and I can't just dump/restore the postgresql database, so I think I must configure these projects thru the web interface. – Xiè Jìléi Jul 22 '11 at 23:57
  • 1
    You can always automate deployment, but note I did mention "where cost-effective". It's always cost-effective to document manual installation procedures, though. – womble Jul 23 '11 at 0:17
  • You are right, I should write more documents, though. And just as you said, the apt-get is broken, damn. – Xiè Jìléi Jul 23 '11 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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