Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sdelete tool for Linux

Posted on 2012-03-14
14
Medium Priority
?
3,799 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If we need to check who deleted a Virtual Machine from our vCenter. Looking this task in logs can be painful and spend lot of time, so the best way to check this is in the vCenter DB. Just connect to vCenter DB(default DB should be VCDB and using…
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…

916 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