LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do you REALLY delete images from a flash drive (such as for a digital camera) (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-you-really-delete-images-from-a-flash-drive-such-as-for-a-digital-camera-4175448052/)

Quon 01-31-2013 05:40 PM

How do you REALLY delete images from a flash drive (such as for a digital camera)
 
I have a 2gb flash drive, and when I open it in Nautilus (on OpenSUSE) and delete the contents (images/videos from my camera), they disappear however they are actually just hidden. The free space doesn't change at all.

Instead it creates a new folder called .Trash-1000 and moves my photos/videos into that folder. If I delete it from there it still doesn't actually delete them either.

F-spot only works for the images, not the videos.

Basically I want to be able to mount my flash drive, and delete its content and stick it back in my camera and then have 2gb of free space again.

I do not know whether this is a Nautilus problem, an OpenSUSE problem, or a Linux problem, but some developers somewhere are mentally retarded. What is the logic behind the stupidity?

Solutions, please...

snowpine 01-31-2013 05:52 PM

Wow, that's kind of insulting, both to the Linux developers and to the mentally handicapped. :(

Anyway, Nautilus has an "empty trash" feature that, you guessed it, empties the trash. You can also go to Preferences->Behavior and enable the "Include a Delete command that bypasses trash" option.

TobiSGD 01-31-2013 05:58 PM

The logic behind that is quite simple. To enable the user to undo a deletion long time ago filemanager developers came up with the idea of a trashcan. So if you use a filemanager to delete files they only get moved to the trashcan. Just empty the trashcan and your files will get deleted permanently. This idea of those "mentally retarded" developers have literally saved an uncountable amount of people from doing their work twice.

The alternative from just emptying the trashcan would be to either tell your filemanager to permanently delete those files (most filemanagers have such an option) or to just delete the files using the commandline, which does not use the trashcan.

Quon 01-31-2013 08:49 PM

Quote:

Originally Posted by snowpine (Post 4881682)
Wow, that's kind of insulting, both to the Linux developers and to the mentally handicapped. :(

Anyway, Nautilus has an "empty trash" feature that, you guessed it, empties the trash. You can also go to Preferences->Behavior and enable the "Include a Delete command that bypasses trash" option.

Changing the setting works for deleting new files (see below) so that is not an issue anymore, but as for emptying the trash, it is not moving the files to the Trash in the first place.

Quote:

Originally Posted by TobiSGD (Post 4881685)
The logic behind that is quite simple. To enable the user to undo a deletion long time ago filemanager developers came up with the idea of a trashcan. So if you use a filemanager to delete files they only get moved to the trashcan. Just empty the trashcan and your files will get deleted permanently. This idea of those "mentally retarded" developers have literally saved an uncountable amount of people from doing their work twice.

The alternative from just emptying the trashcan would be to either tell your filemanager to permanently delete those files (most filemanagers have such an option) or to just delete the files using the commandline, which does not use the trashcan.

I know about the trash can. It does not move the files to the trash can, it is literally hiding the files on the drive.

It creates a hidden file entitled .Trash-1000 where it attempts to hide most of the files but it also seems to be hiding files elsewhere (i know this by looking at the free space which remains 600 MB short of 2 GB, since I managed to delete the contents of the .Trash-1000 folder not by deleting them from the .Trash-1000 folder (since it will only hide them again) but by deleting the folder itself.)

The file > empty trash option does not delete the files from the drive (it deletes files from the trash, the normal trash on the desktop). It does not remove files from the .Trash-1000 folder or anywhere else on the flash drive. To remove files from that folder I had to delete the folder itself, but that still doesn't delete all the files.

Doing so gave me back 1.4 GB however it is still hiding 600 MB worth of files somewhere on my 2gb flash drive and I cannot locate where it is hiding them so there is another place where it is hiding files also.

Whether this 600MB worth of files remaining is due to having deleted the entire .Trash-1000 folder, i do not know, but i doubt it since it makes no sense that it would delete some but not all of the files contained in it. There is probably another place where it is also hiding files from me or else for some reason some of the files remain but are now inaccessible since nothing points to that place on the drive (even by recreating the folder). Nothing reveals itself through "show hidden files".

To reiterate, this is not a matter of deleted files being moved to the trash as is the case when you normally delete something. This is a matter of files being intentionally preserved and deliberately hidden from me somewhere on the device.

Mac OS X is known for pulling this shit too (since I had this problem long ago and resolved it through OS X forums found on Google which I can no longer find since Google panda crapped on the internet), Im guessing the developers responsible were trying to copy.

New problem: I need to get the other 600MB back, but I cannot locate any files on the device (including hidden files).

TobiSGD 01-31-2013 10:05 PM

When emptying the trash does not delete the files in the hidden directory .Trash-1000 there seems to be a bug and it would be nice if you would report it to the Nautilus developers.

To get your space back simply format the drive, this should leave no traces of unreachable files.
You can use GParted or other GUI tools or just mkfs from the commandline for that.

Inkit 02-01-2013 07:57 AM

Hey Quon,
I'm not an expert on Linux, nor am I one on cameras, but I do own a digital camera and do import pictures into my system now and again. A simple solution would be for you to click the "Delete files from device after importing" or some such option while importing. I've not used F-spot in a long time so I'm not sure, but shotwell has this option and it works very well for me. And I've managed to fill and refill my 4 GB's worth of space umpteen times without doing anything else.

But then again, maybe the developers have a personal grudge against you and are doing something just to irritate the crap out of you. ;)

theNbomr 02-01-2013 09:31 AM

The utility du will show where disk space is being used. The rm command will allow you to delete unwanted files. The mkfs command will allow you to format the partition(s) to recover all available space and effectively remove all content. Consult your local man page for the details on each command.

Your insulting language does not endear you to those from whom you seek assistance.

--- rod.

goumba 02-01-2013 10:22 AM

And for the future: Nautilus, Thunar and most file managers under many operating systems, you hold down Shift when you press the Delete key and it bypasses the Trash Can, Recycle Bin, or whatever you want to call it. Those files will be gone.

charging-ibis 02-01-2013 11:16 AM

To do a secure Delete is the use this command:
Code:

dd if=/dev/zero of=/dev/<What ever device it's mounted as> bs=512 count=1
This fills your drive with zeros. This also prevents anybody from recovering your data from your drive versus, if doing a regular rm(delete) command, some one knowledge-able could just recover your pictures or data that you had supposedly deleted. People like, you know: malicious hackers, Law enforcement, etc...

But after using the dd command, go ahead and use what ever disk partitioning tool you prefer to create a partition.

Next run 'partprobe' command so that the system can update the '/etc/fstab'.

Next after committing(Writing) your new partition, you want to use the 'mkfs' utility to create the file system of what ever the file format you desire to use. like:
Code:

mkfs.ext4 /dev/sdb1
After making the file system, go ahead and mount the filesystem for example:
Code:

mount /dev/sdb1 /home/some_user23/pictures/photostuff
Then verify that the file system is mounted by entering:
Code:

mount
You should get a list of all devices and filesystems that are currently mounted. The recently newly created one should be listed @ the bottom of the out put.

I hope this helps you out alot.

~ Thanks.

TobiSGD 02-01-2013 11:29 AM

Quote:

Originally Posted by charging-ibis (Post 4882349)
To do a secure Delete is the use this command:
Code:

dd if=/dev/zero of=/dev/<What ever device it's mounted as> bs=512 count=1
This fills your drive with zeros. This also prevents anybody from recovering your data from your drive versus, if doing a regular rm(delete) command, some one knowledge-able could just recover your pictures or data that you had supposedly deleted. People like, you know: malicious hackers, Law enforcement, etc...

The code you provided will not fill the drive with zeroes, it will just overwrite the MBR with zeroes. This does not in anyway effect the recoverability of the data and therefore is not a secure way to delete data. To get the wanted behavior remove the count option from the command (and use larger blocksizes to get better performance).

theNbomr 02-01-2013 01:18 PM

I don't think the OP is concerned about obscuring anything, just making the full capacity of his media available. Re-writing the partition table will do that, if followed by creating a new filesystem on the media.
I don't know what partprobe does, but I would hope it doesn't add anything to fstab that would try to mount the flash media at boot time. Most people use flash media as removable, and it should probably only be mounted when inserted into a reader. I also wouldn't recommend an ext4 filesystem type on media that a camera is supposed to read/write. All the cameras I've used (small sample size) need a FAT filesystem on the flash media they use.

--- rod.

goumba 02-02-2013 06:23 AM

Quote:

Originally Posted by charging-ibis (Post 4882349)
To do a secure Delete is the use this command:
Next run 'partprobe' command so that the system can update the '/etc/fstab'.

Quote:

Originally Posted by theNbomr
I don't know what partprobe does, but I would hope it doesn't add anything to fstab that would try to mount the flash media at boot time.

partprobe does not do anything to /etc/fstab. It requests that the kernel to re-read the partition table of a device. In fact as it's name implies partprobe only knows about partitions, and nothing of filesystems, and would have no place modifying /etc/fstab.

Being the OP was using the card in some other device (camera), ext4 cannot be used as well. Besides Android phones (and as I own none, I can not speak for it's removable media, only the built in memory), there are very few consumer electronics out there that support anything other than FAT (more specifically FAT32/VFAT).

As far as the condescending attitude toward developers... Windows now has a frowning smiley when it gives a BSoD, so maybe such persons would be happier with such an OS with useless cute stuff.

Like I said earlier, based on the OPs original request, Shift + Delete in Nautilus is all he needed.


All times are GMT -5. The time now is 04:42 AM.