Skip to content

Conversation

@andrewleech
Copy link
Contributor

This allows formatting SD cards, larger flash etc which do not support the default FAT16/SFD format.

eg. import pyb, uos;uos.VfsFat.mkfs(pyb.SDCard())

I presume the default format was chosen for lower overheads when smaller flash spaces are used?

@dpgeorge
Copy link
Member

I presume the default format was chosen for lower overheads when smaller flash spaces are used?

Yes.

Please see #3717 for an existing attempt at this, and comments there.

@andrewleech
Copy link
Contributor Author

Ah yes, your comment there is exactly as I assumed for this patch.

I first attempt to format with the exact settings currently used, only if that fails with the error returned when fat16 isn't supported do I retry with fat32.

As such there should be zero change for anywhere the existing mkfs works.

@dpgeorge
Copy link
Member

As such there should be zero change for anywhere the existing mkfs works.

Yes, it looks good, the patch here.

Also, probably makes sense to just update mkfs (as is done here) and not the "mkfs=True" option of mount, since that was there to support old behaviour of user-mountable block devices.

@dpgeorge
Copy link
Member

Merged in 74d0746

@doc-hex
Copy link
Contributor

doc-hex commented Mar 30, 2021

This fix is incomplete. There is another call to f_mkfs() inside vfs_fat_mount() if mkfs=True. I hit this case recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants