3

On a CentOS 5.3 server the /var folder has changed to a file. Appears to be FS corruption.

Rest of the FS looks OK. Anyone know a quick way to fix this? fsck.ext3 reports the fs as clean even using a force check.

It looks like the machine had the power yanked and when it came back up it was like this.

2 Answers2

1

You likely have quite a few problems I should think, given it's possible any databases, websites, mail spools and log directories have also died in there.

I would seriously recommend taking a block level backup of the disk before you start mucking around in it if you had any sort of important data on that server. dd if=/dev/XXX of=/somewhere/else/disk.img (from memory!)

While knweiss' answer will rebuild your rpm directory and program specific dirs and may let you continue using the server you will need to get in to the file system internals to try recover anything meaningful.

I'd also be concerned about any other directories that have gone missing that you haven't noticed yet. (...and I'm going to assume it really is a file and not just an empty directory where var is on a separate partition that failed to mount.)

Antitribu
  • 1,709
  • 3
  • 23
  • 37
0

Delete the file and restore the /var folder from your backup.

If you don't have a backup you could do rpm -ivh --replacepkgs filesystem...rpm to reinstall the "filesystem" rpm. This will create the empty(!) folder hierarchy of /var. Reboot afterwards. Now, if an application is still not working because something is missing in /var do the same with its rpm.

knweiss
  • 3,955
  • 23
  • 20