1
I'm trying to write a script to do some proceedings with an USB pendrive, deleting any partitions it encounters and creating new ones (more in this link).
When I do the proceedings using GParted, everything works fine, in particular when the new partitions are created with their file systems any old data is gone (and this operation doesn't take much time for the content I'm working with).
But when I do the equivalent proceedings with fdisk
, I always find the old data in the same old partition as it was before!
How can I proceed such that the data of the old partitions is completely erased (and as fast as it happens with GParted)?
I tried commands dd if=/dev/zero of=/dev/sdb bs=512 count=1
and shred -vzn 0 /dev/sdb
or similars but either they wouldn't actually erase the files, or they would take too much time to do it when compared to GParted.
2Off the top of my head, its fdisk, d for delete, w for write. You are writing, right? – Journeyman Geek – 2015-12-03T12:39:32.637
@JourneymanGeek that part is OK; it's just that the files continue to be there after such proceedings! – Momergil – 2015-12-03T12:42:21.127
I found something: when I try to use the call to
– Momergil – 2015-12-03T12:43:53.187mkfs.fat
as done by GParted, the contents remain there, but if I follow this: http://unix.stackexchange.com/questions/40978/how-can-i-format-a-thumb-drive-so-that-i-delete-all-existing-files , then the contents are gone! The difference in the call is that the GParted call includes-v -l
. I just can't say why for me this something-like-a-bug happens!