# Formatting An Sd Card To 4096 Block Size



## carpetman (Apr 2, 2017)

Hi all.  After making the switch to an Mac, I'm getting on very well with it.  Until the Terminal has to be used, then I'm stuck.

My problem is that I need to format an SD card to have a block size of 4096 bytes.  This is because I'd like to install Rockbox on a DAP, namely the Xduoo X3. After following instructions on how to do this, and getting nowhere but a hung DAP,  I wad told that the block size of the SD card needed to be 4096, rather than its current 512.  I can use the terminal to read the details of the card, but not having used it beyond that, I need a bit of hand-holding.

Anyone know how to do it?

Cheers


----------



## DeltaMac (Apr 2, 2017)

Here's a thread that I found, that should show you how to set up your SD card for the block size that you need to use.
http://apple.stackexchange.com/questions/188844/change-drive-block-size-to-4096


----------



## carpetman (Apr 2, 2017)

Thanks Delta, I'd seen that but didn't know if the HFS filesystem was the same as FAT32?


----------



## DeltaMac (Apr 2, 2017)

No. FAT32 and HFS are completely different formats.
If you need fat32, then you need to use basically the same command, but for msdos. I found this thread, that should help you on your way.
http://apple.stackexchange.com/ques...rd-to-fat32-with-custom-allocation-block-size


----------



## carpetman (Apr 3, 2017)

Still no further forwards with this, I can understand how to get Terminal to tell me the /dev/disk etc, 5 in my case. So thats
diskutil unmount disk5s1
I understand the card needs to be unmounted.

sudo newfs_msdos -F 32 -c 128 disk5s1

What do I need to change to achieve the 40976 bytes? is it the -F 32 or the -c 128

Again, many thanks.


----------



## DeltaMac (Apr 3, 2017)

The default block size is 32k.
So, if you want 4096 as your block size, here's your command, with some explanation (as if I know what I am talking about  The explanation that I give here might not be 100% technically correct, but should give you the correct results, which is your goal, eh?)

```
sudo newfs_msdos -F 32 -c 16 disk5s1
```
*sudo* - running command as superuser.
*newfs_msdos* - the command, which is used to manipulate a disk to create (in this instance) a fat partition.
*-F 32* - makes a fat partition, the 32 determines that it will be FAT32
 now for the important part:
*-c 16* -  specifying the sector size on the volume with a ratio of the total block allocation to the block size that you want to use. FAT32 disk has 65536 sectors, divided by your desired block size of 4096 = 16 (!)
*disk5s1* - your actual disk
You can copy and paste that command to your terminal, should work as is. If you type it yourself, be careful about caps. -F is a different option from -f


----------



## carpetman (Apr 3, 2017)

DeltaMac said:


> The default block size is 32k.
> So, if you want 4096 as your block size, here's your command, with some explanation (as if I know what I am talking about  The explanation that I give here might not be 100% technically correct, but should give you the correct results, which is your goal, eh?)
> 
> ```
> ...




Many thanks Delta.  I get this message after entering that....

512 bytes per physical sector

newfs_msdos: 25573 clusters too few clusters for FAT32, need 65525

I'm using  a 128gb card, which I presume has some effect on which sizes are entered?


----------



## DeltaMac (Apr 3, 2017)

Not sure. Some of this stuff is above my pay grade. 
try 
	
	



```
sudo newfs_msdos -F 32 -b 4096 disk5s1
```
or 
	
	



```
sudo newfs_msdos -F 32 -c 8 disk5s1
```


----------

