How to change allocation size for external ssd on mac?
Solution 1:
The diskutil
command is a more reliable than the Disk Utility application when creating two ExFAT partitions on a drive. I do not believe you can specify the Allocation Block Size when ExFAT formatting a partition with either the diskutil
command or Disk Utility application. However, you can with the newfs_exfat
command.
The Allocation Block Size was originally referred to as the cluster size. Microsoft defines the cluster size as follows:
Cluster size represents the smallest amount of disk space that can be used to hold a file. When file sizes do not come out to an even multiple of the cluster size, additional space must be used to hold the file (up to the next multiple of the cluster size).
Basically, a larger cluster size results in faster access times, but at a cost of more wasted space. Certainly, if you have a large number of files significantly smaller that the cluster size, then you will find the volume is consuming far more space than the sum of the file sizes. The is no easy way to answer what you should choose for a cluster size. This really depends on the quantity and size of the files themselves.
There are alternatives, if you are using the disk to archive documents. For example, you could create a single file compressed archive of many documents. This eliminates the wasted space that normally occurs at the end of each file. Again, accessing an archive usually take additional time. You can easily create a zip archive by using the Finder Application. However, you can not use the Finder to view the contents of a zip file without first unzipping the file. You can list the contents of a zip file by using commands entered in a Terminal window. Or you can install a third party tool with a GUI. You can also use the Disk Utility to create a compressed dmg file. Here, you can use the Finder to mount and view the contains of a dmg file without first having to extract the contents.
Example
Below is an example where a 1 TB disk is partitioned into two 500 GB ExFAT volumes. Here the legacy Master Boot Record (MBR) partitioning scheme is used. The identifier for this disk is disk1
. Basically, you specify the size of the first partition and the rest of the space is allocated to the second partition. The names of the volumes are MyExFAT1
and MyExFAT2
.
diskutil partitiondisk disk1 MBR exfat MyExFAT1 500G exfat MyExFAT2 R
Below is the output from this command.
Started partitioning on disk1
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk1s1 as ExFAT with name MyExFAT1
Volume name : MyExFAT1
Partition offset : 2 sectors (1024 bytes)
Volume size : 976562504 sectors (500000002048 bytes)
Bytes per sector : 512
Bytes per cluster: 131072
FAT offset : 2048 sectors (1048576 bytes)
# FAT sectors : 30720
Number of FATs : 1
Cluster offset : 32768 sectors (16777216 bytes)
# Clusters : 3814569
Volume Serial # : 5faa3183
Bitmap start : 2
Bitmap file size : 476822
Upcase start : 6
Upcase file size : 5836
Root start : 7
Mounting disk
Formatting disk1s2 as ExFAT with name MyExFAT2
Volume name : MyExFAT2
Partition offset : 976562507 sectors (500000003584 bytes)
Volume size : 976562533 sectors (500000016896 bytes)
Bytes per sector : 512
Bytes per cluster: 131072
FAT offset : 2048 sectors (1048576 bytes)
# FAT sectors : 30720
Number of FATs : 1
Cluster offset : 32768 sectors (16777216 bytes)
# Clusters : 3814569
Volume Serial # : 5faa3186
Bitmap start : 2
Bitmap file size : 476822
Upcase start : 6
Upcase file size : 5836
Root start : 7
Mounting disk
Finished partitioning on disk1
/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme +1.0 TB disk1
1: Windows_NTFS MyExFAT1 500.0 GB disk1s1
2: Windows_NTFS MyExFAT2 500.0 GB disk1s2
If you wish to use the GUID Partition Table (GPT) scheme instead of the MBR partition scheme, then you would enter the following.
diskutil partitiondisk disk1 GPT exfat MyExFAT1 500G exfat MyExFAT2 R
The output from this command is given below. Note that a small EFI partition is also created.
Started partitioning on disk1
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk1s2 as ExFAT with name MyExFAT1
Volume name : MyExFAT1
Partition offset : 411648 sectors (210763776 bytes)
Volume size : 976562176 sectors (499999834112 bytes)
Bytes per sector : 512
Bytes per cluster: 131072
FAT offset : 2048 sectors (1048576 bytes)
# FAT sectors : 30720
Number of FATs : 1
Cluster offset : 32768 sectors (16777216 bytes)
# Clusters : 3814568
Volume Serial # : 5faa32d6
Bitmap start : 2
Bitmap file size : 476821
Upcase start : 6
Upcase file size : 5836
Root start : 7
Mounting disk
Formatting disk1s3 as ExFAT with name MyExFAT2
Volume name : MyExFAT2
Partition offset : 976973824 sectors (500210597888 bytes)
Volume size : 976150528 sectors (499789070336 bytes)
Bytes per sector : 512
Bytes per cluster: 131072
FAT offset : 2048 sectors (1048576 bytes)
# FAT sectors : 30720
Number of FATs : 1
Cluster offset : 32768 sectors (16777216 bytes)
# Clusters : 3812960
Volume Serial # : 5faa32d7
Bitmap start : 2
Bitmap file size : 476620
Upcase start : 6
Upcase file size : 5836
Root start : 7
Mounting disk
Finished partitioning on disk1
/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme +1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Microsoft Basic Data MyExFAT1 500.0 GB disk1s2
3: Microsoft Basic Data MyExFAT2 499.8 GB disk1s3
In either case, the output from the command diskutil info MyExFAT1 | grep "Block Size"
would be the following.
Device Block Size: 512 Bytes
Allocation Block Size: 131072 Bytes
So, if you wanted a Allocation Block Size of 4096 bytes, then you could enter the following commands. Below, the disk identifier is disk1
and the disk is using the MBR partition scheme.
Note: If you wish,
disk1s1
can be substituted forrdisk1s1
, when entering thenewfs_exfat
command below. However, usingrdisk1s1
results in thenewfs_exfat
command completing quicker.
diskutil info MyExFAT1 | grep Identifier
diskutil unmount disk1s1
newfs_exfat -R -v MyExFAT1 -b 4096 /dev/rdisk1s1
diskutil mount disk1s1
diskutil info MyExFAT1 | grep "Block Size"
These commands would produce the following output.
Marlin-3:imac2015 davidanderson$ diskutil info MyExFAT1 | grep Identifier
Device Identifier: disk1s1
Marlin-3:imac2015 davidanderson$ diskutil unmount disk1s1
Volume MyExFAT1 on disk1s1 unmounted
Marlin-3:imac2015 davidanderson$ newfs_exfat -R -v MyExFAT1 -b 4096 /dev/rdisk1s1
Volume name : MyExFAT1
Partition offset : 2 sectors (1024 bytes)
Volume size : 976562504 sectors (500000002048 bytes)
Bytes per sector : 512
Bytes per cluster: 4096
FAT offset : 2048 sectors (1048576 bytes)
# FAT sectors : 954368
Number of FATs : 1
Cluster offset : 956416 sectors (489684992 bytes)
# Clusters : 121950761
Volume Serial # : 5faa919e
Bitmap start : 2
Bitmap file size : 15243846
Upcase start : 3724
Upcase file size : 5836
Root start : 3726
Marlin-3:imac2015 davidanderson$ diskutil mount disk1s1
Volume MyExFAT1 on disk1s1 mounted
Marlin-3:imac2015 davidanderson$ diskutil info MyExFAT1 | grep "Block Size"
Device Block Size: 512 Bytes
Allocation Block Size: 4096 Bytes
The output from this example was produced using High Sierra (macOS 10.13.6).