Solved

Sdelete tool for Linux

Posted on 2012-03-14
14
2,705 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
Comment Utility
wipe
0
 
LVL 18

Expert Comment

by:TobiasHolm
Comment Utility
Hi!

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

Regards, Tobias
0
 

Author Comment

by:fisher_king
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:fisher_king
Comment Utility
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
Comment Utility
> 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
Comment Utility
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
Comment Utility
> I have not had a chance to run it yet.
so you have no solution yet?
0
 

Author Comment

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

Author Comment

by:fisher_king
Comment Utility
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
Comment Utility
I outlined previously that the expert responses did not provide the solution I was seeking.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Teach the user how to use create log bundles for vCenter Server or ESXi hosts Open vSphere Web Client: Generate vCenter Server and ESXi host log bundle:  Open vCenter Server Appliance Web Management interface and generate log bundle: Open vCenter Se…
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:

762 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

16 Experts available now in Live!

Get 1:1 Help Now