Skip to content

Instantly share code, notes, and snippets.

@psyke83
Created August 29, 2011 12:52
Show Gist options
  • Save psyke83/1178328 to your computer and use it in GitHub Desktop.
Save psyke83/1178328 to your computer and use it in GitHub Desktop.
#1 - restore working copy of /sd-ext partition from backup
~ # dd if=/sdcard/mmc-good.img of=/dev/block/mmcblk0p2 bs=4096
125000+0 records in
125000+0 records out
512000000 bytes (488.3MB) copied, 109.406085 seconds, 4.5MB/s
#2 - check tune2fs output
~ # tune2fs -l /dev/block/mmcblk0p2
tune2fs 1.41.6 (30-May-2009)
Filesystem volume name: <none>
Last mounted on: /data/dalvik-cache
Filesystem UUID: ee402fee-fd48-49ee-a19e-55a95ebf5497
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr dir_index filetype extent sparse_super uninit_bg
Filesystem flags: unsigned_directory_hash
Default mount options: journal_data_writeback
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 125416
Block count: 499713
Reserved block count: 25000
Free blocks: 441464
Free inodes: 125369
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 2056
Inode blocks per group: 257
Filesystem created: Mon Aug 29 08:04:17 2011
Last mount time: Mon Aug 29 08:44:35 2011
Last write time: Mon Aug 29 12:44:24 2011
Mount count: 0
Maximum mount count: 31
Last checked: Mon Aug 29 12:44:24 2011
Check interval: 15552000 (6 months)
Next check after: Sat Feb 25 12:44:24 2012
Lifetime writes: 45 MB
Reserved blocks uid: 0 (user unknown)
Reserved blocks gid: 0 (group unknown)
First inode: 11
Inode size: 128
Default directory hash: half_md4
Directory Hash Seed: 64da3c93-1681-4d47-ae1e-7f411f9cc692
#3 - verify integrity of manually-restored backup
~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p2: 47/125416 files (4.3% non-contiguous), 58249/499713 blocks
#4 - in CWM, perform full backup
#5 - in CWM, perform advanced restore of /sd-ext only
#6 - check tune2fs output of CWM-restored partition
~ # tune2fs -l /dev/block/mmcblk0p2
tune2fs 1.41.6 (30-May-2009)
Filesystem volume name: <none>
Last mounted on: /sd-ext
Filesystem UUID: 57f8f4bc-abf4-0000-675f-946fc0f9f25b
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal resize_inode filetype extent sparse_super large_file
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Remount read-only
Filesystem OS type: Linux
Inode count: 31252
Block count: 125000
Reserved block count: 0
Free blocks: 110362
Free inodes: 31205
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 31
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 7813
Inode blocks per group: 489
Last mount time: Mon Aug 29 12:48:41 2011
Last write time: Mon Aug 29 12:49:00 2011
Mount count: 1
Maximum mount count: -1
Last checked: Thu Jan 1 00:00:00 1970
Check interval: 0 (<none>)
Lifetime writes: 42 MB
Reserved blocks uid: 0 (user unknown)
Reserved blocks gid: 0 (group unknown)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
Default directory hash: tea
Journal backup: inode blocks
#7 - check integrity of CWM-restored partition
~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Inode bitmap differences: -(7809--7813) +(7837--7841) -(15617--15624) +(15627--15634)
Fix? yes
/dev/block/mmcblk0p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p2: 47/31252 files (2.1% non-contiguous), 14638/125000 blocks
e2fsck: Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p2
#8 - in CWM, format /sd-ext partition
#9 - verify integrity of freshly-formatted partition
~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 7814 (/???)
Connect to /lost+found? yes
Unconnected directory inode 15627 (/???)
Connect to /lost+found? yes
Unconnected directory inode 15628 (/???)
Connect to /lost+found? yes
Unconnected directory inode 15634 (/???)
Connect to /lost+found? yes
Pass 4: Checking reference counts
Inode 2 ref count is 0, should be 3. Fix? yes
Inode 7814 ref count is 3, should be 2. Fix? yes
Inode 15627 ref count is 3, should be 2. Fix? yes
Inode 15628 ref count is 3, should be 2. Fix? yes
Inode 15634 ref count is 3, should be 2. Fix? yes
Pass 5: Checking group summary information
Block bitmap differences: +(2560--7766) +(16384--17123) +(33292--33303) +(33312--36914) +(36916--37192) +(37196--37199) +(66027--66802)
Fix? yes
Free blocks count wrong for group #0 (30288, counted=24341).
Fix? yes
Free blocks count wrong for group #1 (32244, counted=28348).
Fix? yes
Free blocks count wrong for group #2 (32277, counted=31501).
Fix? yes
Free blocks count wrong (120981, counted=110362).
Fix? yes
Inode bitmap differences: +(7814--7841) +(15627--15634)
Fix? yes
Free inodes count wrong for group #1 (7813, counted=7785).
Fix? yes
Directories count wrong for group #1 (0, counted=1).
Fix? yes
Free inodes count wrong for group #2 (7813, counted=7805).
Fix? yes
Directories count wrong for group #2 (0, counted=3).
Fix? yes
Free inodes count wrong (31241, counted=31205).
Fix? yes
/dev/block/mmcblk0p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p2: 47/31252 files (2.1% non-contiguous), 14638/125000 blocks
e2fsck: Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p2
#10 - manually format via mke2fs
~ # mke2fs /dev/block/mmcblk0p2
warning: 287 blocks unused
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
125416 inodes, 499713 blocks
25000 blocks (5%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
61 block groups
8192 blocks per group, 8192 fragments per group
2056 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
#11 - verify integrity of manually-formatted partition
~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p2: 11/125416 files (0.0% non-contiguous), 15840/499713 blocks
@psyke83
Copy link
Author

psyke83 commented Aug 29, 2011

#8 - in CWM, format /sd-ext partition
#9 - verify integrity of freshly-formatted partition

~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 7814 (/???)
Connect to /lost+found? yes

Unconnected directory inode 15627 (/???)
Connect to /lost+found? yes

Unconnected directory inode 15628 (/???)
Connect to /lost+found? yes

Unconnected directory inode 15634 (/???)
Connect to /lost+found? yes

Pass 4: Checking reference counts
Inode 2 ref count is 0, should be 3. Fix? yes

Inode 7814 ref count is 3, should be 2. Fix? yes

Inode 15627 ref count is 3, should be 2. Fix? yes

Inode 15628 ref count is 3, should be 2. Fix? yes

Inode 15634 ref count is 3, should be 2. Fix? yes

Pass 5: Checking group summary information
Block bitmap differences: +(2560--7766) +(16384--17123) +(33292--33303) +(33312--36914) +(36916--37192) +(37196--37199) +(66027--66802)
Fix? yes

Free blocks count wrong for group #0 (30288, counted=24341).
Fix? yes

Free blocks count wrong for group #1 (32244, counted=28348).
Fix? yes

Free blocks count wrong for group #2 (32277, counted=31501).
Fix? yes

Free blocks count wrong (120981, counted=110362).
Fix? yes

Inode bitmap differences: +(7814--7841) +(15627--15634)
Fix? yes

Free inodes count wrong for group #1 (7813, counted=7785).
Fix? yes

Directories count wrong for group #1 (0, counted=1).
Fix? yes

Free inodes count wrong for group #2 (7813, counted=7805).
Fix? yes

Directories count wrong for group #2 (0, counted=3).
Fix? yes

Free inodes count wrong (31241, counted=31205).
Fix? yes

/dev/block/mmcblk0p2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p2: 47/31252 files (2.1% non-contiguous), 14638/125000 blocks
e2fsck: Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p2
#10 - manually format via mke2fs

~ # mke2fs /dev/block/mmcblk0p2
warning: 287 blocks unused

Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
125416 inodes, 499713 blocks
25000 blocks (5%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
61 block groups
8192 blocks per group, 8192 fragments per group
2056 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
#11 - verify integrity of manually-formatted partition

~ # e2fsck -yf /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p2: 11/125416 files (0.0% non-contiguous), 15840/499713 blocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment