Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

First of all, security is important so I want to use a reasonable size of inode backups and things like that, whatever those mean...

I want to use ext2 or ext3 for a common partition between Win7 and Ubuntu (with ext2fsd).

My problem is, that I created a 850 gig ext2 partition and GParted says:

Size: 853.15 GiB
Used:  13.46 GiB

This is NOT the 5% space reserved to the root user (it would be more than 40gigs). And of course I tried tune2fs -m 0 /dev/sda4. Is it normal that 13 gig is lost just for the filesystem?

All help is appreciated.

Some details if you need it:

# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=     2048, size=   389120, Id=83, bootable
/dev/sda2 : start=   393214, size= 82028546, Id= 5
/dev/sda3 : start= 82429515, size= 81915435, Id= 7
/dev/sda4 : start=164345856, size=1789177856, Id=83
/dev/sda5 : start=   393216, size= 78123008, Id=83
/dev/sda6 : start= 78518272, size=  3903488, Id=82

df says:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda5             38445384   5101796  31390516  14% /
none                   2021640       660   2020980   1% /dev
none                   2029348      1512   2027836   1% /dev/shm
none                   2029348       348   2029000   1% /var/run
none                   2029348         0   2029348   0% /var/lock
/dev/sda1               182331     22620    149983  14% /boot
/dev/sda4            880550492     73744 880476748   1% /media/334cb5f6-2f18-4193-b2c8-99bd42cd6f01

tune2fs -l /dev/sda4 says:

tune2fs 1.41.14 (22-Dec-2010)
Filesystem volume name:   
Last mounted on:          
Filesystem UUID:          334cb5f6-2f18-4193-b2c8-99bd42cd6f01
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              55918592
Block count:              223647232
Reserved block count:     0
Free blocks:              220119187
Free inodes:              55918581
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      970
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Sat May 21 10:35:15 2011
Last mount time:          n/a
Last write time:          Sat May 21 11:21:55 2011
Mount count:              8
Maximum mount count:      20
Last checked:             Sat May 21 10:35:15 2011
Check interval:           15552000 (6 months)
Next check after:         Thu Nov 17 09:35:15 2011
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     28
Desired extra isize:      28
Default directory hash:   half_md4
Directory Hash Seed:      7ba9b270-1cc8-4622-b25c-768497678f99

cat /etc/mke2fs.conf says:

[defaults]
    base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
    blocksize = 4096
    inode_size = 256
    inode_ratio = 16384

[fs_types]
    ext3 = {
        features = has_journal
    }
    ext4 = {
        features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
        inode_size = 256
    }
    ext4dev = {
        features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
        inode_size = 256
        options = test_fs=1
    }
    small = {
        blocksize = 1024
        inode_size = 128
        inode_ratio = 4096
    }
    floppy = {
        blocksize = 1024
        inode_size = 128
        inode_ratio = 8192
    }
    news = {
        inode_ratio = 4096
    }
    largefile = {
        inode_ratio = 1048576
        blocksize = -1
    }
    largefile4 = {
        inode_ratio = 4194304
        blocksize = -1
    }
    hurd = {
         blocksize = 4096
         inode_size = 128
    }
share|improve this question

1 Answer 1

up vote 1 down vote accepted

After reading, and then reading a bit more I came to the conclusion that the inodes are taking up this tremendous amount of space.

You can confirm this with the tune2fs output by multiplying the following values:

Inode count:              55918592
Inode size:               256

... and this will indeed give you the missing 13 gigs (14 315 159 552).

In the make2fs.conf file you can see the following default: inode_ratio = 16384. Multiplying this with the number of inodes gives the full partition size (916 170 211 328), so this is exactly what it seems. The number of inodes is calculated by partition size / inode_ratio.

As I read shrinking the inode size is not recommended, but the inode_ratio itself will give you a wide space to move. The largefile preset creates an inode for every 1 MByte.

I did not went that far (no small operating-system-files will be stored on this partition, but downloads and sometimes source code will), so I ended up with a moderated 128000. It does not have to be a power of 2, inodes are not a 1-1 mirror of the HD data (like FAT16), they are used more dynamically.

This (combined with -m 0 of course) only took 2 gigs out of my big partition. Which is something I can live with.

mkfs.ext3 -i 128000 -m 0 /dev/sda4

This gave me 9 million inodes (which limits the maximum number of files and dirs too, that can be stored on the HD). But as I said earlier, no OS will be installed on it, and cosidering the linux kernel source contains around 25 000 files, the step from the earlier 55 mill to 9 mill inodes seems to be a good tradeoff.

Disclaimer:

You must be careful about setting up the inode_ratio, as your filesystem will bear this forever. You can not add inodes to (an ext2 or ext3) partition afterwards without reformatting it.

It is also not possible to just shrink the partition and create a new one on the free space if you run out of inodes because shrinking the partion would proportinally decrease inodes, so you can not do it with only a few inodes free.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.