0

Virtual machine was abruptly killed and the fs is now in an unclean state. Linux would not start, geting stuck on fsck. When I mount the image:

mount /virtual_drives/biginfoservice /mnt -o loop,offset=$((512*2048))
umount /mnt
losetup -f /virtual_drives/biginfoservice -o 1048576
fsck.ext4   -y /dev/loop0

fsck runs for many hours trying to fix one directory that it "restored" which now contains garbage:

Entry 'sess_7923mp40fl72qs9ni3c8qligb5' in /var/lib/php5.BAD (267290) has deleted/unused inode 1892267.  Clear? yes
Entry 'sess_fgido54kard9qjcgvoqpbltma2' in /var/lib/php5.BAD (267290) has deleted/unused inode 540172.  Clear? yes
Entry 'sess_9jhiqqg7o5tvglr46h1iv8bsd5' in /var/lib/php5.BAD (267290) has deleted/unused inode 2263409.  Clear? yes
Entry 'sess_b1tlsoun1uac3rua4ct7prgur6' in /var/lib/php5.BAD (267290) has deleted/unused inode 937173.  Clear? yes
Entry 'sess_3n901mtmvgdn8gkej9vs524sq6' in /var/lib/php5.BAD (267290) has deleted/unused inode 2081592.  Clear? yes

I also tried

rm -rf  /mnt/var/lib/php5.BAD

which also runs very long time (more than an hour), without any progress indication. CPU is the bottleneck, one core at 100%. The "restored" inode is huge: 130Mb, and useless: it only keeps stale php sessions. Here is stat /mnt/var/lib/php5.BAD:

  File: `/mnt/var/lib/php5.BAD/'
  Size: 133345280       Blocks: 260584     IO Block: 4096   directory
Device: 700h/1792d      Inode: 267290      Links: 2
Access: (1733/drwx-wx-wt)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-03-03 16:43:01.893840698 +0200
Modify: 2019-03-03 17:02:15.343784806 +0200
Change: 2019-03-03 17:02:15.343784806 +0200

It seems that copying 160Gb of the "good" files would be faster than fixing the existing image. Is there a faster way to get rid of this corrupt directory, like truncate?

Your Answer

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

Browse other questions tagged or ask your own question.