Click to See Complete Forum and Search --> : cluster sizes in linux (Debian Woody)


Syngin
04-14-2002, 02:33 PM
Hey guys, I justy added a 40 gig harddrive thanks to the help of previous posts on the topic here and have one last question:

How do I format the drive so that the cluster sizes are the lowest possible? I currently have the drive in ext2 and had copied 5 gig worth of mp3s over to it. The problem is that I notice that this 5 gig folder is taking up 300 meg more space on my LInux system as it was on my Windows 2k box.

I can only think that this is because the cluster size is greater on the linux box? Would going to ext3 help this or does anyone know what I can do to avoid this? At that rate of loss, 2.4 gig of space is going to go missing by the time the drive is full.

demian
04-14-2002, 02:41 PM
You can adjust the blocksize and the bytes-per-inode with the -b and -i switch respectively during filesystem creation. Valid values for the block size are 1024 bytes and integer multiples thereof. bytes-per-inode should be larger or equal to the block size.

Syngin
04-14-2002, 02:48 PM
Thanks demian.

Could you give me a syntax example? I used the following line to create the file system:

mke2fs /dev/hdd1

(Yup, this is my secondary slave drive)

I'd probably be looking for a block size similar to NTFS (512) although I'm not certain what is meant by bytes-per-anode.

Overall, this drive is just for storage and most thing will be compressed if that makes a difference.

Would I do the following?

mke2fs -b 512 -i 512 /dev/hdd1

demian
04-14-2002, 03:06 PM
> mke2fs -b 512 -i 512 /dev/hdd1

As I said the smallest permitted value is 1024 (so says the man page). So

mke2fs -b 1024 -i 1024 /dev/hdd1

would do. I don't know how wise it is to have that many inodes, though. Basically you need one inode to store the information about one file/symlink/... on that partition. Now you say that this is your mp3 partition. So the avarage file size will be a few megabytes meaning that you will never use most of the inodes. They are, however, stored in a table at the beginning of that partition and the more inodes are referenced there, the more space is taken away for actual use.

So if you are ceratain that you will store only large files on that partition you can savely use something like 1048576 bytes per inode (meaning you will have n inodes on that partition, n being the partition size in MB. Note that this doesn't mean that every single file takes up one MB. This is controlled by the block size wich can be as small as 1024 bytes.

Also if this is a pure data partition you can savely neglect to reserve space for the root user (5% per default). Putting things together you might use a call like

mke2fs -b 1024 -i 1048576 -m 0 /dev/hdd1

Be aware that you cannot change the block size and bytes per inode value once the filesystem is created without recreating it. You can, however, change the reserved block percentage (-m) without recreating the filesystem using tune2fs -m <#> /dev/hdd1.

Syngin
04-14-2002, 03:20 PM
Cheers. Very helpful indeed. I was really sketchy on file system creation but this helps out a lot. I'll let you know how things go. :-)