vi .swp recovery file corrupted: "unable to read block 1...", original file zero length

From: Milica Medved (positively_no_spam_at_yahoo.com)
Date: 03/05/04


Date: 5 Mar 2004 09:29:32 -0800

Hi all,

I have Red Hat 9 Pro installed on a Sager 5680 laptop. It's running
fine, except that every now and then the system hangs completely. I'm
still troubleshooting that, and am leaning towards overheating as a
cause.

On one such occasion, my setup-bold.txt file that was open got
corrupted.
Events (everything happens to root, I was in the process of installing
drivers):

    0 - vi: VIM 6.1.320, kernel: 2.4.20-6, custom compiled

    1 - ~/setup-bold.txt is open
    2 - system hangs as I am compiling wlan drivers
    3 - hard reboot, missed the opportunity to force fsck on boot
    4 - was scared of fsck-ing a mounted filesyste, did another hard
reboot
    5 - forced filesystem check during reboot, no messages
    6 - su, cd, vi ~/setup-bold.txt
    7 - vi: blah-blah, found .swp file, the usual, choose (R)ecovery
    8 - the following error:
======================================================
Swap file ".setup-bold.txt.swp" already exists!
"setup-bold.txt" 0L, 0C
Using swap file ".setup-bold.txt.swp"
Original file "~/setup-bold.txt"
E308: Warning: Original file may have been changed
E309: Unable to read block 1 from .setup-bold.txt.swp
=======================================================
    9 - the file is opened as 0L, 0C. lenthg on disk is 0.
   10 - I've rebooted several times since, did fsck -fn, found 3
        orphaned inodes, and one with dtime 0, but haven't changed
        anything as I can't unmount the partition (/).

I am in the process of making a bootable floppy, so that I can run one
final fsck, although I don't expect much. I can open, read, copy,
rename, and diff this .swp file, and I still get the "block 1"
message. I am guessing that this is not a problem with the file
system, but with the vi, and hoping I can hack the recovery file.

Text editing the recovery file gives garbage (although I can make out
my hostname. This file is my installation log, that holds the results
of about a week of full-time googling and trouble-shooting. It wasn't
backed up, as I was still in the middle of installation. :(

Qs:

1) Is there a way to hack this and get the text back?
2) Could it be a filesystem issue, and can it be fixed now?
3) How unsafe is it to fsck a mounted filesystem (and we're talking
   about / here)? I only have two partitions, / and /boot.

I've used Linux for ~8 years, and I've never seen this before. Google
didn't help. :(

Thanks,
Milica



Relevant Pages