3

I recently purchased a Sandisk Extreme SSD to work with Mac and Android.

  1. Is it possible to create 2 exFAT partitions of the drive? (Currently, I managed to do a combination of exFAT and HFS/Mac OS Extended (Journaled))
  2. Is it possible to change the allocation size using Disk Utility on Mac?

Running the command:

diskutil info /Volumes/PartitionName/ | grep "Block Size"

gives the default sector size as:

# For exFAT partition
Device Block Size:        512 Bytes
Allocation Block Size:    131072 Bytes

# For Mac OS Extended partition
Device Block Size:        512 Bytes
Allocation Block Size:    4096 Bytes

However, I didn't get the option to decide the allocation block size while partitioning/erasing the disk on Mac. Am I missing something?

Also, what should be the appropriate allocation size considering I am planning to store photos, documents and backup data? For eg. this review suggests formatting the hard disk before using with appropriate allocation size on Windows (like 128kb).

If we follow the answer provided here, could you please explain how to change allocation size (instead of device block size) with newfs_exfat

Platform: macOS High Sierra Version 10.13.6

4
  • The link you posted to the accepted answer does explain how to change the allocation size. The device block size can not be changed by software. – David Anderson Nov 10 '20 at 7:19
  • Thanks, @DavidAnderson for the detailed answer. Oh yeah, thanks for clarifying about the device block vs allocation size. Is it also recommended to change the sectors-per-cluster (-c flag)? While HFS default is 4096 bytes, do we face any issues with using the same on exFAT? – shubhamagarwal92 Nov 10 '20 at 12:16
  • You can use either the -b or -c option with the newfs_exfat command. If you use both -b and -c options, then the arguments must result in the same bytes-per-cluster. Otherwise, an error message will be produced. Since SSD have either a Device Block Size of 512 or 4096 bytes, then specifying -b 4096 should be acceptable. – David Anderson Nov 10 '20 at 13:32
  • Thanks again @DavidAnderson – shubhamagarwal92 Nov 12 '20 at 4:04
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 for rdisk1s1, when entering the newfs_exfat command below. However, using rdisk1s1 results in the newfs_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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .