Avatar of fisher_king
fisher_king
 asked on

Sdelete tool for Linux

I have a client with a virtual (VMware) server running Debian 6 (Squeeze). They deleted a bunch of logs, but I want to remove them from the virtual disks also, similar to what sdelete can do in Windows. I found that shred is supposed to do this, but from what I read it appears to pertain to deleting a specific file or folder, which have already been deleted within the OS (but are still on the virtual disks).

Is shred the correct tool to use to delete the empty space on the disk (and get rid of deleted files/folders)? If so, what is the correct command to use to clean the entire drive? Or is there another tool that will work better?

Thanks.
Linux DistributionsVMware

Avatar of undefined
Last Comment
fisher_king

8/22/2022 - Mon
ahoffmann

wipe
TobiasHolm

Hi!

Read this: http://linux.die.net/man/1/wipe

Regards, Tobias
fisher_king

ASKER
Thanks for the replies.

It looks like wipe is for clearing everything in a directory or on entire disks. In this case, the files have already been deleted by the OS and there are other files in the directory - but the files are still on the disks, which make my vmware backup image much larger than it needs to be. Sdelete can delete everything in empty space (files that have been already deleted in the OS, but are still present on the disk), which is what I am looking for.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ahoffmann

sounds like a filesystem issue then
i.g. *ix filesystems are that lazy when deleting files and it's much more difficult to reconstruct them
but your issue seems to be that you "have the feeleing" that the space is not freed, right?
this is a problem of your host vm, tools for deleteng files and freeing their space in the guest won't help you here
anyway, if your filesystem is  ext2/ext3/ext4 you may play around with debugfs
TobiasHolm

Sounds to me like you're looking for a tool to remove the "holes" in the VMware disk file after files have been deleted on the virtual disk? I think there are build in tools in VMware to compress a disk file (to shrink it).

Regards, Tobias
fisher_king

ASKER
Thanks again for the replies.

I have more than a feeling about the files. The client recently deleted 5 GB of old logging files and started new logs, and the image backup increased in size even though the amount of space used reportedly decreased in linux. I have encountered this situation many times on windows guests and I run sdelete within windows to clear the deleted space - I actually have it run weekly as a scheduled task on on my windows guest servers. I will check with VMware to see if there is anything included in their tools, but I do not want to compress the disk file. The disk file within VMware is the full size of the disk and that has not changed - the backup program is configured to skip any blank space on the disk, but it sees the deleted files even though the OS has let go of them.

Thanks again.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
fisher_king

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
fisher_king

ASKER
I've requested that this question be closed as follows:

Accepted answer: 0 points for fisher_king's comment #37727244

for the following reason:

The expert responses did not outline how to zero the deleted space.<br /><br />Thanks for the replies.
ahoffmann

> The client recently deleted 5 GB of old logging files and started new logs, and the image backup increased in size ..
hmm, are you saying that you delete (rm) the logfile of a running process?
if so the cat /dev/zero soloution won't work either (however, exception are possible)

you have to stop the process, delete the file, then restart the process
or you need to use special tools, i.e. logrotate

reason is that the command/programs available in user space (like rm) only remove the inode information, but not the inode itself and the running process has an inode as file handle

hope this helps
fisher_king

ASKER
Thanks for the advice.

The server is running a database program, and the client deletes the log files through the program - not directly on the server. What I need to do is zero the empty space, which is what the command I mentioned is supposed to do. I have not had a chance to run it yet.

Thanks again.
Your help has saved me hundreds of hours of internet surfing.
fblack61
ahoffmann

> I have not had a chance to run it yet.
so you have no solution yet?
fisher_king

ASKER
True - I have not verified the solution yet. I will re-post when I do.
fisher_king

ASKER
Sorry for the delay - the client wanted to schedule the command to run after-hours. The command ran successfully and reduced the compressed backup image from 7 GB to 4 GB.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fisher_king

ASKER
I outlined previously that the expert responses did not provide the solution I was seeking.