Question: Recently had a LVM'd CentOS 6.5 install get accidentally cold-shutdown. On bootup, it says that the home partition need fscking:

```
/dev/mapper/vg_myserver-lv_home: Block bitmap for group 3072 is not in group.  (block 3335668205)

/dev/mapper/vg_myserver-lv_home: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

```

...but I guess the root partition is OK, since it gives me a shell there. So we run `e2fsck -b 32768 /dev/mapper/vg_myserver/lv_home` and after saying Yes to various fixes, on Pass 5 it just prints endless numbers to the screen, very fast. Once in a while it will print them in neat columns, and if these are block numbers, after a couple hours we are still nowhere near the first 2% being done of our 1.2 TB LV.

I read that you can use `cleap_mmp` with `tune2fs`, but upon trying that, it doesn't accept cleap\_mmp nor list it among valid options.

My question is, how does everyone deal with a corrupt ext4 fs without weeks of downtime? Does everyone have this dilemma, or weeks of downtime vs rebuilding your server / lost data? If so why does anyone use or recommend the use of ext4? Is there some trick I'm missing that would **let me target the specific block/group it's complaining about**, so we can get on with it and mount the home fs again?

Answer: 
Option `--perl-regexp` (short `-P`) of GNU `grep` uses more powerful regular expressions that include look ahead patterns. The following pattern looks for each letter that this letter does not appear in the remainder of the word:

```
grep -Pow '((\w)(?!\w*\g{-1})){10}'

```

However the run-time behavior is quite bad, because `\w*` can have nearly infinite length. It can be limited to `\w{,8}`, but that also checks beyond the word limit of 10 letters. Therefore the following pattern first checks the correct word length:

```
grep -Pow '(?=\w{10}\b)((\w)(?!\w*\g{-1})){10}'

```

As test file I have used a large ≈ 500 MB file: 

* First pattern: ≈ 43 s
* Latter pattern: ≈ 15 s

**Update:**

I couldn't find a significant change in the run-time behavior for a non-greedy operator (`\w*?`) or possessive operator (`(...){10}+`). A tiny bit faster seems the replacement of option `-w`:

```
grep -Po '\b(?=\w{10}\b)((\w)(?!\w*\g{-1})){10}\b'

```

An update of grep from version 2.13 to 2.18 was much more effective. The test file only took ≈ 6 s.
A Perl solution:

```
perl -lne 'print if (!/(.)(?=$1)/g && /^\w{10}$/)' file

```

but it doesnt work with

```
perl -lne 'print if (!/(.)(?=\1)/g && /^\w{10}$/)' file

```

or

```
perl -lne 'print if ( /(.)(?!$1)/g && /^\w{10}$/)' file

```

tested with perl v5.14.2 and v5.18.2