Re: zeroing out part of an SDcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nice.

http://www.spinics.net/lists/linux-btrfs/msg36918.html

No special tool needed. e.g. I just tested this with Gnome Disks, with the default "don't overwrite with zeros (quick format)" option, using btrfs. All of, and only that chosen partition, was completely erased in about 2 seconds. Every sector returns FF's [1] other than btrfs superblocks.

I did a strace on mkfs.xfs, mkfs.ext4, and mkfs.vfat -F32; but did not test this in Gnome Disks. The strace reveals that both xfs and ext4 use BLKDISCARD, while vfat does not. xfs and ext4 further makes use of:

ioctl(3, BLKDISCARDZEROES, 0)           = 0

I'm not sure what this does. Maybe it causes erased blocks to deterministically return zeros instead of FF's?

Anyway, it looks like SD cards are in effect "trimmed" by formatting them ext4, xfs or btrfs, as long as the tool being used is using the fs's mkfs command, and also doesn't pass a nodiscard option.

I didn't test mkfs.ntfs or mkfs.hfs, but like vfat if any of them aren't calling BLKDISCARD it's probably a valid feature request for their upstream. Meanwhile a workaround is to use mkfs.btrfs with no options, and then wipefs -a that same partition, and then format with the preferred filesystem.


Chris Murphy



[1]
[root@twenty1 chris]# dd if=/dev/mmcblk0p2 bs=1M skip=313 | hexdump -C
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux