Solved

Sdelete tool for Linux

Posted on 2012-03-14
14
2,818 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
Teach the user how to delpoy the vCenter Server Appliance and how to configure its network settings Deploy OVF: Open VM console and configure networking:
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

912 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now