blk_itr = fs->super->s_first_data_block;
for (i = 0; i < fs->group_desc_count; i++) {
/* get bitmap data of allocated blocks in current group */ ret = ext2fs_get_block_bitmap_range(fs->block_map, blk_itr, blocks_bitmap_len * 8,
blocks_bitmap);
first_block = ext2fs_group_first_block(fs, i);
last_block = ext2fs_group_last_block(fs, i);
/* set them relative to current block */ first_block -= blk_itr; last_block -= blk_itr; /* parse blocks bitmap, from first to last (included) */
for (j = first_block; j <= last_block; j++) {
}
With e2fsprogs < 1.41.9, on a empty 2G filesystem, the tool reports:
- Total sectors : 4194304 = 2048 MiB
- Used sectors : 2300256 = 1123 MiB (54.84%)
While with e2fsprogs >= 1.41.9, the tools reports:
- Total sectors : 4194304 = 2048 MiB
- Used sectors : 203104 = 99 MiB (4.84%)
I'd like to make the tool reporting a correct results regardless to the library used. I'm currently stuck to blacklist older e2fsprogs which doesn"t make user of Debian happy, for example.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What program are you trying to write and what distribution are you trying to support? There are enough bugs with the ext4 support in e2fsprogs versions older than 1.41.9 that it's really not worth it to work around it in an application program. My recommendation is to check the library version using ext2fs_get_library_version() and then exit with an error if you see a version of e2fsprogs that old…. tell the user to upgrade, since they will be running into many other problems with ext4 support.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This a program that lists the used physical sectors of a ext2,ext3, ext4 filesystem.
I'm ok to blacklist any e2fsprogs older than 1.41.9 regarding to ext4, it's a sane solution. Thanks for your advice.
But it should be OK to use previous e2fsprogs for ext2 and ext3. So I must add a check on filesystem feature to detect filesystem flavor known or not to work.
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, it's just a tool to create another kind of disk image. This is an old tool, part of LRS (Linbox Rescue Server), which was using e2fsprogs-1.22 (statically linked !). I've made it use the system shared library instead, so it could also process ext4 filesystem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Commit "libext2fs: Treat uninitialized parts of bitmaps as unallocated"
http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commitdiff;h=f4240c8d56520b95f0a8f956ba31e204e105467e
included since e2fsprogs v1.41.9 introduces a welcome fix.
But how to workaround the previous behavor when using older version of e2fsprogs libraries ?
How to detect that a bitmap set to 0xff is in fact not allocated ?
Regards.
Superblock records the number of inodes per disk group. From this you can figure out how many bits at the tail end of the bitmap you should ignore.
I'm using this code (adapted from dumpe2fs):
See http://pulse2.mandriva.org/browser/pulse2/client/imaging/trunk/tools/revosave/image_e2fs.c
How can I check that there's no block bitmap for a group without looking into ext2fs data structure: I wan't to use library function only ?
Thanks.
With e2fsprogs < 1.41.9, on a empty 2G filesystem, the tool reports:
- Total sectors : 4194304 = 2048 MiB
- Used sectors : 2300256 = 1123 MiB (54.84%)
While with e2fsprogs >= 1.41.9, the tools reports:
- Total sectors : 4194304 = 2048 MiB
- Used sectors : 203104 = 99 MiB (4.84%)
I'd like to make the tool reporting a correct results regardless to the library used. I'm currently stuck to blacklist older e2fsprogs which doesn"t make user of Debian happy, for example.
What program are you trying to write and what distribution are you trying to support? There are enough bugs with the ext4 support in e2fsprogs versions older than 1.41.9 that it's really not worth it to work around it in an application program. My recommendation is to check the library version using ext2fs_get_library_version() and then exit with an error if you see a version of e2fsprogs that old…. tell the user to upgrade, since they will be running into many other problems with ext4 support.
This a program that lists the used physical sectors of a ext2,ext3, ext4 filesystem.
I'm ok to blacklist any e2fsprogs older than 1.41.9 regarding to ext4, it's a sane solution. Thanks for your advice.
But it should be OK to use previous e2fsprogs for ext2 and ext3. So I must add a check on filesystem feature to detect filesystem flavor known or not to work.
Regards.
I'm just curious; is this program intended to assist in data recovery after a hard drive failure?
No, it's just a tool to create another kind of disk image. This is an old tool, part of LRS (Linbox Rescue Server), which was using e2fsprogs-1.22 (statically linked !). I've made it use the system shared library instead, so it could also process ext4 filesystem.