A
A
Athanasius Sidorov2021-01-31 00:44:27
Hard disks
Athanasius Sidorov, 2021-01-31 00:44:27

How to specify the cluster size when creating a file system?

Hello everybody! When creating a file system, for example, in windows fat32, you can specify the cluster size when formatting. For example 4kb. How to do it in linux? Maybe there is some parameter in mkfs? I did not find such settings in gparted.
For example, in the ext4 file system, btrfs, xfs, f2fs, etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zettabyte, 2021-01-31
@Zettabyte

Maybe there is some parameter in mkfs?

man mkfs.ext4:
OPTIONS
       -b block-size
              Specify  the  size  of blocks in bytes.  Valid block-size values
              are 1024, 2048 and 4096 bytes per block.  If omitted, block-size
              is  heuristically  determined  by  the  filesystem  size and the
              expected usage of the filesystem (see the -T option).  If block-
              size  is preceded by a negative sign ('-'), then mke2fs will use
              heuristics to determine the appropriate  block  size,  with  the
              constraint  that  the  block  size  will  be at least block-size
              bytes.  This  is  useful  for  certain  hardware  devices  which
              require that the blocksize be a multiple of 2k.

-C cluster-sizeSpecify the size of cluster in bytes for filesystems using the bigalloc feature. Valid cluster-size values ​​are from 2048 to 256M bytes per cluster. This can only be specified if the bigalloc feature is enabled. (See the ext4 (5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size.
Accordingly, you will also need something in the spirit of -O bigalloc
But I would highly recommend trying everything on a test machine first, without important data, because. I met complaints about problems with mounting the FS after such operations, at least on ext.

M
Mikhail Vasilyev, 2021-01-31
@vasilyevmn

man mkfs.ext4
-C cluster-size
Specify the size of cluster in bytes for filesystems using the bigalloc feature. Valid cluster-size values are from 2048 to 256M bytes per cluster. This can only be specified if the bigalloc feature is enabled. (See the ext4 (5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size.

-b block-size
Specify the size of blocks in bytes. Valid block-size values are 1024, 2048 and 4096 bytes per block. If omitted, block-size is heuristically determined by the filesystem size and the expected usage of the filesystem (see the -T option). If block-size is preceded by a negative sign ('-'), then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes. This is useful for certain hardware devices which require that the blocksize be a multiple of 2k.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question