Notatypewriter's Blog

Umm… what?

Posts Tagged ‘ext3

Huh?! I didn’t run out of disk space…

with one comment

Windows destroyed my partition table a couple weeks ago, so I had to reinstall Ubuntu and recreate my somewhat complicated dm-crypt+LVM partition layout. This gave me an opportunity to reformat my partitions.

The Ubuntu (and Debian) alternate installer presents the user with a choice for usage scenarios: standard, news, largefile, and largefile4. These let the user choose how many inodes to create for that partition, which limits how much space is used by inodes. Each inode is 256 bytes. But since ext{2,3,4} uses one inode per file or directory, it also puts an upper limit on the number of files in the filesystem.

Usually, the larger your files, the fewer inodes you want to create. If you have large files, you’ll run out of space before you run out of inodes, so you want more space and fewer inodes.

I chose largefile4. I was copying some of my backed-up data back onto the partition when I got an error “no space left on device.” I was pretty confused. I was only copying 8.2 GiB of stuff onto a 82 GiB partition. Turns out it was because I ran out of inodes. The largefile4 option created only 21141 free inodes and I had 24319 files in this set of data. The largefile4 option was obviously a bad idea. This data was mostly jpegs, so the file sizes were much too small to take advantage of the fewer inodes.

After reformatting each filesystem, I ran tune2fs to list the number of inodes available for use (Free inodes value). You can see the ratios used by looking in /etc/mke2fs.conf. Here were the results for the same partition (containing 21657600 4096-byte blocks for a total size of 82 GiB):

largefile4: 21141 = 5 MiB = ~0% usage
largefile: 84597 = 20 MiB =  ~0% usage
defaults: 5414901 = 1322 MiB = 1% usage
news: 21659637 = 5288 MiB = 6% usage

I haven’t picked which one to use yet, but it’s down to largefile and defaults. 1322 MiB is almost a whole movie file. Or I could always specify an inode_ratio in between…

UPDATE: I settled on an inode_ratio of 262144 which gives me 338421 free inodes, which is about 80 MiB. Very little usage yet lots of files. 🙂

Written by notatypewriter

2011 May 18 at 7:07 pm

Posted in Nerding out

Tagged with , , , , ,

%d bloggers like this: