Jump to content

4MB sectors - aka "Optimizing Linux with cheap flash drives"


Recommended Posts

Just came across this
Might be useful for developers
Improved Optimization/speed and wear leveling of software on SD Cards

https://lwn.net/Articles/428584/

It's an older report...but it might help since devices are getting bigger and the need to keep the cards alive longer is getting more and more important

My take on the document is that 4MB blocks or when writing the image
Write to SD card using Linux:
- Find the device (eg: /dev/sdb1) you need to write to by using blkid or mount.
- Double check that you have the correct dev path for your SD card (eg: /dev/sdb1).
- Unmount the SD card and all its partitions by using umount /dev/sdb?.
- Write the image using dd if=/path/to/DietPi_vXX.img of=/dev/sdb.

sudo dd if=/path/to/DietPi_vXX.img of=/dev/sdb bs=4096


or

sudo dd if=/path/to/DietPi_vXX.img of=/dev/sdb bs=4M

Link to comment
Share on other sites

1 hour ago, WarHawk_AVG said:

My take on the document is that 4MB blocks or when writing the image

 

That's irrelevant since it happens above the filesystem layer.

 

It's all about partition alignment. I changed this last year to 4MB boundaries.

 

This resulted in a partition alignment at 4 MB boundaries (before we were using 1 MB) so after this change less wear on SD card but '3 MB wasted'.

 

Since unlike other projects we do not promote the use of old, small and crappy SD cards and the minimum card size you get today is 16GB* I think 'wasting' 3MB on a 16GB card is nothing to care about.

 

* (personal recommendation: SanDisk Ultra A1 16GB -- but always check prices of the larger variants since at least 32GB are not that much more expensive than the 16GB variant)

Link to comment
Share on other sites

7 hours ago, WarHawk_AVG said:

sudo dd if=/path/to/DietPi_vXX.img of=/dev/sdb bs=4M

The "bs=" means "block size", it has nothing to do with "sector size" of a file system.

It is only the size of the buffer used between reading the source and writing destination.

Of course, a bs=4M will do the transfers faster than a bs=4096, which is not the same since the later means 4096 bytes.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines