5

I have an 512 GB SSD on my MacBook Retina with one of the volumes disks0s6 formatted with exFat to use it on both Mac and Windows.

diskutil info disk0s6:

   Device Identifier:        disk0s6
   Device Node:              /dev/disk0s6
   Part of Whole:            disk0
   Device / Media Name:      Basic data partition

   Volume Name:              WORK
   Escaped with Unicode:     WORK

   Mounted:                  Yes
   Mount Point:              /Volumes/WORK
   Escaped with Unicode:     /Volumes/WORK

   File System Personality:  ExFAT
   Type (Bundle):            exfat
   Name (User Visible):      ExFAT

   Partition Type:           Microsoft Basic Data
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 PCI
   SMART Status:             Verified
   Volume UUID:              40CF8BFC-3143-3BB9-B659-DE1A62DCA9E6

   Total Size:               54.1 GB (54117007360 Bytes) (exactly 105697280 512-Byte-Units)
   Volume Free Space:        36.1 GB (36128292864 Bytes) (exactly 70563072 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                No

   Whole:                    No
   Internal:                 Yes
   Solid State:              Yes

I have lots of small files in that volume and my small files took to much physical space so I want to reformat the volume with a minimum Device Block Size and Cluster Size so my small files won't take any additional space. How can I do that in OS X?

Here is an example of files in folder bower_components which is 46.1 MB taking 9.75 GBspace on the disk(printed from windows):

enter image description here

UPDATE 1

I didn't found a way how to check cluster size on Mac so I boot in Windows and run chkdsk on that drive: enter image description here

As you can see 131072 bytes in each allocation unit - that is my current cluster size being created by Mac DiskUtil default

UPDATE 2

Just booted back to Mac and run the command sudo newfs_exfat -N /dev/disk0s6:

Reformatting existing ExFAT volume
Partition offset : 871407616 sectors (446160699392 bytes)
Volume size      : 105697280 sectors (54117007360 bytes)
Bytes per sector : 512
Bytes per cluster: 131072
FAT offset       : 2048 sectors (1048576 bytes)
# FAT sectors    : 3328
Number of FATs   : 1
Cluster offset   : 6144 sectors (3145728 bytes)
# Clusters       : 412856
Volume Serial #  : 0227bd88
Bitmap start     : 2
Bitmap file size : 51607
Upcase start     : 3
Upcase file size : 5836
Root start       : 4

So looks like chkdisk showed same 131072 bytes per cluster

7

The maximum allocation block (or cluster) count for exFAT is 2^32 = 4,294,967,296.

To get the minimal size of an allocation cluster on your partition divide the size of your partition through 2^32.

Examples:

  • for a 100 GB partition the minimal size is 100,000,000,000 bytes/4,294,967,296=~23.3 bytes. Since the smallest device block size is 512 bytes, the allocation block size can't be smaller.

  • For a 3 TB partition the minimal size is 3,000,000,000,000 bytes/4,294,967,296=~698.5 bytes. The minimal possible allocation block size is then 1024 bytes.

To format a partition use newfs_exfat [options] /dev/disk*s*

The following options regarding allocation block sizes are available:

 -b bytes-per-cluster
         File system block size (bytes per cluster).  Acceptable values
         are powers of 2 in the range 512 through 33554432.

 -c sectors-per-cluster
         Sectors per cluster.  Acceptable values are powers of 2 in the
         range 1 through 65536. 

To reformat your exFAT volume first copy the content to another volume. Then enter:

diskutil list #to get the disk identifier of the exFAT partition
diskutil unmount /dev/disk0s6
sudo newfs_exfat -c 1 -v exFAT /dev/disk0s6
diskutil mount /dev/disk0s6

The command will create one allocation (or cluster) block/device block and rename the volume to exFAT.

Alternatively you may use

sudo newfs_exfat -b 512 -v exFAT /dev/disk0s6

Most modern HDDs or SSDs use device block sizes of 4096 bytes and the displayed device block size of 512 bytes is only a "logical" device block size probably for compatibility reasons. So a minimal allocation block size of at least 4096 bytes is recommended.

Also the default cluster block sizes of various sized exFAT partitions in Windows "mention" at least 4 kb.


To get the current cluster block size (and other informations) of an exFAT volume do the following:

diskutil list #to get the disk identifier of the exFAT partition
diskutil unmount /dev/disk0s6
sudo newfs_exfat -N /dev/disk0s6
diskutil mount /dev/disk0s6
  • how can I check what is the current cluster size? I can see that my Device Block Size 512 Bytes but cant find a way to check what is the current cluster size. – Kuncevic Nov 2 '15 at 11:21
  • @Riapp added explanation how to get the current values – klanomath Nov 2 '15 at 11:31
  • Just updated the question with details. Looks like my cluster size is 131072 bytes which is was being created by Mac DiskUtil by default. – Kuncevic Nov 2 '15 at 11:31

You must log in to answer this question.

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