bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dealing with ext3 and sparse_super


From: abeiro
Subject: Dealing with ext3 and sparse_super
Date: Thu, 05 May 2005 13:57:20 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.0.3)

Hello everyone;

I've been making some tests with parted software lately. As many of you know,
parted has problems with ext2/ext3 filesystems created with the sparse_super
flag.

This is quite annoying, as by default, a simple mkfs.ext3 command will make
a filesystem with the flags 'has_journal filetype sparse_super'.

Any use of libparted ext2 resize functions will end with the message 'This ext2
filesystem has an strange layout'. Diving in the code, we'll find :

libparted/fs_ext2/ext2.c:

if (EXT2_GROUP_BLOCK_BITMAP(fs->gd[i]) != bb ||
                    EXT2_GROUP_INODE_BITMAP(fs->gd[i]) != ib ||
                    EXT2_GROUP_INODE_TABLE(fs->gd[i]) != it)
                {
ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                                PED_EXCEPTION_CANCEL,
                        _("This ext2 filesystem has a rather strange layout!  "
                          "Parted can't resize this (yet)."));

That's the point where the ext3 checking exists with an error.

I've just commented out that code this way:

if (EXT2_GROUP_BLOCK_BITMAP(fs->gd[i]) != bb ||
                    EXT2_GROUP_INODE_BITMAP(fs->gd[i]) != ib ||
                    EXT2_GROUP_INODE_TABLE(fs->gd[i]) != it)
                {
                        fprintf(stderr,"EXT2_GROUP_BLOCK_BITMAP -> %lld bb ->
%lld\nEXT2_GROUP_INODE_BITMAP -> %lld ib -> %ll
d\nEXT2_GROUP_INODE_TABLE  -> %lld it -> %lld\n",
                                                              
EXT2_GROUP_BLOCK_BITMAP(fs->gd[i]),bb,
                                                              
EXT2_GROUP_INODE_BITMAP(fs->gd[i]),ib,
                                                              
EXT2_GROUP_INODE_TABLE(fs->gd[i]),it);

                        /*
                         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                                PED_EXCEPTION_CANCEL,
                        _("This ext2 filesystem has a rather strange layout!  "
                          "Parted can't resize this (yet)."));
                        return 0;
                         */

So I've made a partition of 2GB with the unfamous flags, then I've filled it
over 80% with  random data and made a md5sum of all it's files.

Then I used parted to resize the partition, and i got this output:

EXT2_GROUP_BLOCK_BITMAP -> 281474976776192 bb -> 281479271743489
EXT2_GROUP_INODE_BITMAP -> 281492156645378 ib -> 275012622328
EXT2_GROUP_INODE_TABLE  -> 4613656343264362498 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 562949953552384 bb -> 562954248519681
EXT2_GROUP_INODE_BITMAP -> 562967133421570 ib -> 549890529272
EXT2_GROUP_INODE_TABLE  -> 4613656343264362500 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 844424930328576 bb -> 844429225295873
EXT2_GROUP_INODE_BITMAP -> 844442110197762 ib -> 824768436216
EXT2_GROUP_INODE_TABLE  -> 4613656343264362502 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1125899907104768 bb -> 1125904202072065
EXT2_GROUP_INODE_BITMAP -> 1125917086973954 ib -> 1099646343160
EXT2_GROUP_INODE_TABLE  -> 4613656343264362504 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1407374883880960 bb -> 1407379178848257
EXT2_GROUP_INODE_BITMAP -> 1407392063750146 ib -> 1374524250104
EXT2_GROUP_INODE_TABLE  -> 4613656343264362506 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1548112372269056 bb -> 1548116667236353
EXT2_GROUP_INODE_BITMAP -> 1548129552138242 ib -> 1511963203576
EXT2_GROUP_INODE_TABLE  -> 4613656343264362507 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1688849860657152 bb -> 1688854155624449
EXT2_GROUP_INODE_BITMAP -> 1688867040526338 ib -> 1649402157048
EXT2_GROUP_INODE_TABLE  -> 4613656343264362508 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1829587349045248 bb -> 1829591644012545
EXT2_GROUP_INODE_BITMAP -> 1829604528914434 ib -> 1786841110520
EXT2_GROUP_INODE_TABLE  -> 4613656343264362509 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 1970324837433344 bb -> 1970329132400641
EXT2_GROUP_INODE_BITMAP -> 1970342017302530 ib -> 1924280063992
EXT2_GROUP_INODE_TABLE  -> 4613656343264362510 it -> 578603803545174017
EXT2_GROUP_BLOCK_BITMAP -> 2111062325821440 bb -> 2111066620788737
EXT2_GROUP_INODE_BITMAP -> 2111079505690626 ib -> 2061719017464
EXT2_GROUP_INODE_TABLE  -> 4613656343264362511 it -> 578603803545174017

No errors. Remounted the resized partition and checked again all files making
md5sums of them. The data on the filesystem remained unchanged.

Making a ext3 filesystem with mkfs.ext3, and then using tune2fs -O ^sparse_super
doesn't solve the problem, as parted will remain complaining about 'strange
layout'.

mkfs.ext3 -O has_journal,filetype,^sparse_super will create a filesystem fully
compatible with libparted.

So seems the offending code for this problem is the checks made by
ext2_determine_itoffset. I think this function is called when
ped_file_system_check is used. Are these check vital for parted to do the
resizing?.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]