1

I'm formatting a hard drive into NTFS file system with Gparted. But I also need to change the cluster size also called allocation unit size or block size. After a few research on the Internet it seems it can't be done when formatting with Gparted.

I couldn't find any information on how to perform it on Linux. I've already tried Gparted and Gnome Disk Utility but those programs don't work because they don't have an option for it. So how can I do that on Linux ?

Nicryc
  • 707
  • This is usually a property of the disk, communicated by the firmware, not something you can change. – harrymc Jan 19 '20 at 17:42
  • 2
  • @DavidPostill: I meant "not something you should change". – harrymc Jan 19 '20 at 17:51
  • 1
    @harrymc There are valid performance reasons for changing the cluster size, for example "If you are going to store multimedia stuff that is usually huge in size, make cluster bigger to increase a performance." – DavidPostill Jan 19 '20 at 17:56
  • @DavidPostill: I don't believe that this will make any difference for performance. But it may make space management more restrictive. – harrymc Jan 19 '20 at 18:41
  • @harrymc "If you have lots of large files, keeping it higher will increase the system performance by having less blocks to seek. " – DavidPostill Jan 19 '20 at 18:47
  • @DavidPostill: You may trick the OS, but never the disk firmware, – harrymc Jan 19 '20 at 18:48
  • @harrymc "I don't believe that this will make any difference for performance" -- Wrong, there is a performance benefit. The cluster guarantees that the sectors are contiguous, so a larger cluster means the OS can then utilize a larger multi-sector read or write ATA command, rather than multiple smaller requests for the same number of sectors. ATA Command overhead is reduced, something rarely discussed/considered by end-users. – sawdust Jan 20 '20 at 06:24
  • @sawdust: Not wrong. Cluster size does not matter for large files, because they will be allocated as contiguous as possible in any case. For small files the big clusters will only cause wasted space. So no gain in almost all cases. – harrymc Jan 20 '20 at 07:02
  • @harrymc "they will be allocated as contiguous as possible in any case" -- Again you're wrong, because you are conflating sequential accesses with reduced command overhead. One does not imply the other. Also I have empirical evidence that contradicts your (irrelevant) claim. I use Windows Media Center on several PCs to record TV, and defrag programs indicate that these large files are rarely allocated contiguously even when it's a solo active recording and a near-empty filesystem. – sawdust Jan 22 '20 at 06:39
  • @sawdust: Large clusters do not also imply that they are allocated contiguously. Your argument is lacking. – harrymc Jan 22 '20 at 07:03
  • @harrymc "Large clusters do not also imply that they are allocated contiguously. Your argument is lacking" -- No, what is obviously lacking is your understanding of what a cluster is. A cluster (regardless of size) is always a set of contiguous LBAs/sectors. Otherwise you would need another level of allocation tables. – sawdust Jan 22 '20 at 07:17
  • @sawdust: There is a lot that you need to learn before arguing so strongly. This is only the OS view. The firmware is free to do what it likes, even more so on SSDs. In any case, the view that the OS has of the disk is a fiction, as even in a hard disk the tracks do not all have the same size. – harrymc Jan 22 '20 at 08:34
  • @harrymc -- My decades of OS (and disk controller firmware) development/experience override your guesses. – sawdust Jan 22 '20 at 10:23

2 Answers2

3

Tell Gparted to create an empty partition, then use the 'mkfs' command apropriate for the filesystem – that's the equivalent of the Windows 'format' command. For example, if you want to create an NTFS filesystem, you'll be using mkfs.ntfs (and Gparted itself will be using the same tool as well).

According to its manual, mkfs.ntfs accepts the -c <bytes> option for cluster size:

mkfs.ntfs -c 4096 /dev/sdc9
u1686_grawity
  • 452,512
  • What do you mean by "create an empty partition" ? My hard drive is currently blank it just has a partition table at the moment. Should I let it like that, should I create a cleared partition or an unformatted partition (both are Gparted options when creating a new partition) or should I create a normal NTFS partition ? – Nicryc Jan 19 '20 at 18:34
  • 2
    Doesn't matter which – since you'll be reformatting it with mkfs, it will throw away the old contents either way. So it will be quickest if you select "unformatted". – u1686_grawity Jan 19 '20 at 18:48
  • Don't forget to use sudo (at least in my case) – Cadoiz Mar 13 '23 at 13:52
0

@harrymc's comments:

"This is usually a property of the disk, communicated by the firmware, not something you can change."

This is wrong. Cluster size is a file system property and has nothing to do with firmware.

If it was a property on firmware level such operation would not be possible.

"allocation unit size" is another term for cluster size.

Maybe you are confusing "cluster size" with "native sector size" and "emulated sector size".

Cadoiz
  • 527
r2d3
  • 3,554