Formatting and mounting a single file in Linux

Ext3 has 30K directory limit inside one single directory and I needed to create ~180K.

Crap, I need another filesystem, which might be ext4, xfs or something like it. But I can’t shutdown a production server or plug another disk. So I created one file which is big enough for my needs (let’s say 100G):

truncate -s 100G my_ext4_blockfile

Let’s format the file:

mkfs.ext4 my_ext4_blockfile

Now, you can mount the file wherever you like:

mkdir new_disk mount -t ext4 my_ext4_blockfile new_disk

System will mount it with help of loop device, you might check it via mount command.


Gürkan

linux

97 Words

2014-02-27 11:27 +0000