ext2 plugin doesn't support files larger than 2G

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
sadyc
Junior Member
Junior Member
Posts: 18
Joined: 2004-09-10, 07:57 UTC
Location: Bucharest, Romania

ext2 plugin doesn't support files larger than 2G

Post by *sadyc »

ext2 plugin doesn't support files larger than 2G

any chance this will be fixed?

--sadyc
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

In principle, the plugin interface can support it. The ext2 plugin is based on a tool called explore2fs, I don't know whether this tool supports files > 2 GB now.
Author of Total Commander
https://www.ghisler.com
sadyc
Junior Member
Junior Member
Posts: 18
Joined: 2004-09-10, 07:57 UTC
Location: Bucharest, Romania

Post by *sadyc »

The latest version (1.00pre6b) of explore2fs does.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

ext2fs is a file system plugin, which uses WIN32_FIND_DATA, so 64 bit numbers are no problem.
Author of Total Commander
https://www.ghisler.com
sadyc
Junior Member
Junior Member
Posts: 18
Joined: 2004-09-10, 07:57 UTC
Location: Bucharest, Romania

Post by *sadyc »

So, have you actually tested it with files >2G and file >4G, and it worked for you?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48166
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Not with the ext2 plugin, but my sample plugin which shows the local file system shows files >4 GB without any problems. The sample plugin is on
http://www.ghisler.com/plugins.htm#filesys
in the section "FS-Plugin writer's guide 1.3".
Author of Total Commander
https://www.ghisler.com
sadyc
Junior Member
Junior Member
Posts: 18
Joined: 2004-09-10, 07:57 UTC
Location: Bucharest, Romania

Post by *sadyc »

ghisler(Author) wrote:ext2fs is a file system plugin, which uses WIN32_FIND_DATA, so 64 bit numbers are no problem.
Well.. things aren't that simple.
I've tracked down why ext2fs plugin doesn't support files larger than 2/4G.

Here is how size is stored in an ext2 inode (from ext2fs plugin code):

Code: Select all

	  	i_size         : ULONG;		// Size in bytes */
So, it is obvious that you can't have a file larger than 4G.

However, ext2 _does_ have files larger than 4G. How?
It uses a trick to store the higher 32 bits (from a 64bits integer) in the following field:

Code: Select all

	  	i_dir_acl      : ULONG;		// Directory ACL */
As you can see it is used for directory ACL, thus for regular files it can be used as an extension for file size.
Here is proof from Linux kernel 2.4 ext2 source:

Code: Select all

	inode->i_size = le32_to_cpu(raw_inode->i_size);
and lower in the code ..

Code: Select all

	if (S_ISREG(inode->i_mode))
		inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
The ext2fs plugin does not use the i_dir_acl extension for the i_size. From TINode.SaveToFile function:

Code: Select all

   Size     := info.i_size;
Even more, the variables are only 32bit integers:

Code: Select all

   Size     : ULONG;
   Written  : ULONG;
Oh, and btw the number of redirects (in case of links) i think has grow from 5 to 8.
It was not a file system restriction but a linux kernel internal restriction.

--adrian
Post Reply