Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

Reformatting vs Deleting

If you are having a problem with getting any of your computer's hardware to work with MEPIS or you can't find the right driver, this is the forum to use. It's for newbies and regular users to post questions. Just make sure to post what hardware you are having problems with, in the subject and not just in the post's text area, please.
Message
Author
User avatar
joany
Forum Veteran
Forum Veteran
Posts: 5919
Joined: Mon Feb 12, 2007 1:45 pm

Reformatting vs Deleting

#1 Post by joany » Mon Oct 13, 2014 1:05 pm

What is the difference between deleting everything on a storage device and reformatting it? For example, if I use a flash drive to temporarily store data, is there any reason to periodically reformat it instead of just deleting the files?
MX-14; 3.12-0.bpo.1-686-pae kernel using 4GB RAM
2.4GHz AMD Athlon 4600+
NVidia GeForce 6150 LE; 304.121 Display Driver
You didn't slow down because you're old; you're old because you slowed down.

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9263
Joined: Sun Dec 16, 2007 1:17 pm

Re: Reformatting vs Deleting

#2 Post by dolphin_oracle » Mon Oct 13, 2014 1:22 pm

I find that for routine stuff, if a flash drive has a lot of files on it, reformatting is a faster way to clear off the cruft.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
joany
Forum Veteran
Forum Veteran
Posts: 5919
Joined: Mon Feb 12, 2007 1:45 pm

Re: Reformatting vs Deleting

#3 Post by joany » Mon Oct 13, 2014 1:52 pm

dolphin_oracle wrote:I find that for routine stuff, if a flash drive has a lot of files on it, reformatting is a faster way to clear off the cruft.
Could you be more specific as to what "cruft" is in the case of a flash drive?
MX-14; 3.12-0.bpo.1-686-pae kernel using 4GB RAM
2.4GHz AMD Athlon 4600+
NVidia GeForce 6150 LE; 304.121 Display Driver
You didn't slow down because you're old; you're old because you slowed down.

User avatar
Eadwine Rose
Forum Veteran
Forum Veteran
Posts: 6002
Joined: Wed Jul 12, 2006 2:10 am

Re: Reformatting vs Deleting

#4 Post by Eadwine Rose » Mon Oct 13, 2014 1:54 pm

Deleting hidden files maybe?
MX-17.1_x64 Horizon 14-3-2018 * 4.15.0-1-amd64 ext4 Xfce 4.12.3 * AMD Asus M4A785TD-V EVO AM3 * ASUS GF GT640-1GD5-L NVIDIA 384.130 * AMD Proc. Athl II X4 635, sAM3 * HDA ATI SB VT1708S An * 2x4Gb DDR3 1600 Kingst * 22" Samsung SyncM P2250 * HP F2280

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9263
Joined: Sun Dec 16, 2007 1:17 pm

Re: Reformatting vs Deleting

#5 Post by dolphin_oracle » Mon Oct 13, 2014 2:04 pm

joany wrote:
dolphin_oracle wrote:I find that for routine stuff, if a flash drive has a lot of files on it, reformatting is a faster way to clear off the cruft.
Could you be more specific as to what "cruft" is in the case of a flash drive?

oh anything. I've got some large drives that my son and I use for moving around all sorts of files, school and work projects, music, videos, whatever... Especially if a drive has, say, 20 gb of music on it, formatting is much faster for us than deleting a couple of thousand individual files. I like to clean off the drives before I use them for other things.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
GDixon
Forum Regular
Forum Regular
Posts: 358
Joined: Fri Nov 02, 2007 4:39 pm

Re: Reformatting vs Deleting

#6 Post by GDixon » Mon Oct 13, 2014 2:11 pm

If it's just one or two files I delete if it's all the files on the drive then I reformat. Reformat might be harder on a flash stick but it's faster and it is nice to start fresh.

Deleting I imagine just involves the table that has the files stored and reformating involves the mbr.

Interesting question and one I never thought about before.

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9263
Joined: Sun Dec 16, 2007 1:17 pm

Re: Reformatting vs Deleting

#7 Post by dolphin_oracle » Mon Oct 13, 2014 2:26 pm

a "quick" reformat (dos windows world) just deletes the file allocation table (at least on a fat32 stick). deleting updates the file allocation table for each individual file as they are deleted. I tend to keep my sticks fat32 for maximum compatibility.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
Gordon Cooper
Forum Guide
Forum Guide
Posts: 1980
Joined: Mon Nov 21, 2011 5:50 pm

Re: Reformatting vs Deleting

#8 Post by Gordon Cooper » Wed Oct 15, 2014 12:40 am

A query from an ignoramus, how many times can you reformat a stick before having problems? Do they behave like camera memory cards?

User avatar
chrispop99
Forum Guide
Forum Guide
Posts: 2362
Joined: Tue Jan 27, 2009 3:07 pm

Re: Reformatting vs Deleting

#9 Post by chrispop99 » Wed Oct 15, 2014 4:14 am

Gordon Cooper wrote:A query from an ignoramus, how many times can you reformat a stick before having problems?
I'm afraid that's a 'how long is a piece of string' question.

They do have limitations on the number of writes, but there will be large variations between makes, and also between individual, ostensibly identical ones. I've run Linux installs from them, including having a swap partition, and they have survived. (I've never done this for more than a few days whilst testing however.) I've also had reputable brands fail in a fairly short time, and would never use them for permanent data backup where the possibility exists that at any one moment in time, that would be the only place the data was.

WRT the original question, if a stick only contains non-sensitive data there is nothing to be gained from formatting. It won't make the stick work any better than just deleting unwanted files, and may shorten its life.

If the stick contains sensitive, unencrypted data then formatting won't make it totally irrecoverable. You would need to wipe it with something like Dban. Of course, it would have been much safer to have encrypted the data on the stick in the first place!

Chris
Test machines:
32-bit non-PAE - Thinkpad T41, 1.6GHz Pentium M, 1GB RAM.
32-bit PAE - DELL Latitude D610, 1.73GHz Pentium M, 2GB RAM.
64-bit - Lenovo T61, 2GHz Core 2 Duo, 2GB RAM
64-bit - Gigabyte Z77P-D3, Intel i3-3220, GeForce 8400 GS, 4GB PC3-12800.

User avatar
JimC
Forum Guide
Forum Guide
Posts: 1413
Joined: Tue Jul 25, 2006 12:47 pm

Re: Reformatting vs Deleting

#10 Post by JimC » Wed Oct 15, 2014 8:16 am

Personally, I'd suggest you always reformat any memory card or flash drive prior to every reuse.

When you perform a "Quick" versus "Full" format, that's only recreating the FAT (File Allocation Table) on the card, not overwriting everything on it.

That way, you always start out with a fresh FAT, as you may have unnoticed FAT corruption otherwise. Then, it's a good idea to use the Operating System's "Safely Remove" feature before removing a card.

With most Operating Systems, you can simply "right click" on the entry for the device in a file manager and use the "Eject" choice for that purpose. That makes sure that anything still left in the Operating System's cache has been flushed to the media and that it's been unmounted for Safe Removal.

Usually, formatting a card (as long as it's a quick versus full format) is faster than deleting the files individually anyway.

Starting out with a fresh FAT also helps to prevent fragmented files. Note that with Flash Media, fragmention won't hurt performance, and because of wear leveling, different physical blocks are being used versus the logical blocks the OS and utilities would see reported.

But, for data recovery purposes (where utilities like photorec or similar will try to look for file headers and piece together your files that way), it's best not to have any fragmentation at the logical level (so that the blocks for most files will appear to be consecutive to the recovery program).

I'm trying to recover images from a card now that has a corrupted FAT, where the entries for the files look OK (names, data/time stamps, etc.). But, some of the space for those files were overwritten by other files. I'm preaching to the card owner to make sure he reformats it prior to each reuse going forward, and to make sure he uses the "eject" choice before removing it each time.

The card is physically fine (and I just made a disk image copy of it using ddrescue for use with other tools like photorec), with no read errors copying the card. But, the FAT is corrupted (probably due to writing to it and then removing it too soon before the OS cache was finished flushing because he didn't bother to "safely remove" it).

Now, I use FAT32 for removal media. With other file systems, YMMV as to if the same things apply.

Edit/Added: Quick versus Full

If you use Windows Vista or higher, a Full Format not only recreates the file system (e.g. FAT32), but also zero files the drive (which can take a long time). Yet, a Quick Format only recreates the File System (fast since it's not overwriting the entire drive).

With Linux, utilities like mkdosfs only recreate the file system (so that you start out with a new FAT), which is fast, without overwriting the entire drive. Again, IMO, always reformatting flash media before every reuse is a good idea, so that you always start out with a fresh, uncorrupted FAT (and that's usually faster than trying to delete the files on it anyway).

So, you could do it this way as root (using fdisk -l to make sure you're working with the correct flash drive, using umount /dev/sdxx to make sure it's unmounted, then using mkdosfs to format it as FAT32.

#su

# fdisk -l

Assuming it is sdc1 (and make sure you are working with the correct drive versus sdc1 in this example, based on the devices reported by fdisk -l), you'll need to unmount it like this if it's already mounted:

# umount /dev/sdc1

Then, enter this to format it as FAT32 (what I suggest using for most flash media for better compatibility with more operating systems for easier sharing of files).

# mkdosfs -F 32 -I /dev/sdc1

Note that you'll need to make sure dosfstools is installed to get mkdosfs

Post Reply

Return to “Hardware General”