I would like to format an SD card to fat32 with 64kb Block Size. Disk utility seems to do use 32kb by default and there is no option to change this. Is there a terminal command to do what I want to do?
-
What are you trying to accomplish?– AllanNov 5, 2016 at 17:15
-
1Trying to use a larger SD card for a Nintendo 3DS. Its supposed to support only up to 32GB but if you format it using fat32, you can use larger cards. Ive been told larger cards can slow down the system but using larger cluster sizes like 64kb can alleviate this.– StrangeluvNov 5, 2016 at 17:19
-
How much are you going to really gain? If your file is 65K (64K + 1K) then you will use 128K; 63K wasted. Bigger blocks equal more waste. This was a concern when storage was slow and expensive, but no longer.– AllanNov 5, 2016 at 17:29
1 Answer
To format a disk with custom (FAT) allocation block sizes use the -c option with e.g. sudo newfs_msdos -F 12|16|32 diskXsY
. -F is the FAT type (usually FAT32 here).
First get the disk identifier with diskutil list
and the block size of the disk with diskutil info diskYsX | grep "Device Block Size"
.
To get the -c factor divide the wanted allocation block size by the device block size: e.g. 65536/4096 = 16. Acceptable values are powers of 2 in the range 1 through 128.
Assuming the device block size is 512 Bytes in your case, the factor is 65536/512 = 128 and the resulting command is:
diskutil umount disXsY
sudo newfs_msdos -F 32 -c 128 diskXsY
An additional -v name
option will also add a name for the volume.
-
1To format into 32kb "clusters" (block size), the
c
factor is computed like this:-c $((32*1024/512))
, i.e. 32kb --> 32*1024 bytes, and since my drive hadDevice Block Size: 512 Bytes
, I divided by 512. The command is thussudo newfs_msdos -F 32 -c 64 diskXsY
Mar 21, 2022 at 14:14