Solved

Sdelete tool for Linux

Posted on 2012-03-14
14
3,165 Views
Last Modified: 2012-06-02
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.
0
Comment
Question by:fisher_king
  • 8
  • 4
  • 2
14 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37723844
wipe
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 37723945
Hi!

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

Regards, Tobias
0
 

Author Comment

by:fisher_king
ID: 37726320
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.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 37726680
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
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 37726800
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
0
 

Author Comment

by:fisher_king
ID: 37727031
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.
0
 

Accepted Solution

by:
fisher_king earned 0 total points
ID: 37727244
Someone pointed me to the correct solution. Run the following command from within the linux guest:

"cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill"

See http://www.electrictoolbox.com/vmware-shrink-vmware-disk/ for the complete article (note that you only need the above command to zero out the free space and do not have to follow all the steps to shrink the disk file).
0
 

Author Comment

by:fisher_king
ID: 37731245
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.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37728333
> 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
0
 

Author Comment

by:fisher_king
ID: 37731225
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.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37731246
> I have not had a chance to run it yet.
so you have no solution yet?
0
 

Author Comment

by:fisher_king
ID: 37731382
True - I have not verified the solution yet. I will re-post when I do.
0
 

Author Comment

by:fisher_king
ID: 37748961
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.
0
 

Author Closing Comment

by:fisher_king
ID: 38039617
I outlined previously that the expert responses did not provide the solution I was seeking.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
Teach the user how to install log collectors and how to configure ESXi 5.5 for remote logging Open console session and mount vCenter Server installer: Install vSphere Core Dump Collector: Install vSphere Syslog Collector: Open vSphere Client: Config…
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question