delete v3 & deleteperm v2 introduced for RHEL7 & RHEL 6: XFS & EXT FS.

April 19, 2019
delete v3 and deleteperm v2 commands are now available to install and use.

delete and undelete commands are installed using delete rpm and deleteperm command has a separate rpm.

Download the RPMs from this page:- Delete and deleteperm RPMs


 

I. How to use delete command ?
a. Delete File.

[root@ngelinux ~]# echo "Welcome to delete command demo" > testfile1
[root@ngelinux ~]# cat testfile1 
Welcome to delete command demo

[root@ngelinux ~]# delete testfile1 

You are running this command with root

This program DOES NOT GUARANTEE TO RECOVER ALL DATA
Whatever data is KEPT ON BLOCKS & NOT OVERWRITTEN BY KERNEL CAN BE RECOVERED

In case its overwritten then you will get the overwritten data and the old data can't be recovered unless you have backup :)
DO YOU STILL WANT TO CONTINUE ?
Press y to continue, any other key to quit.
y


Congratulations for running the command first time !!!

Created metadata file to keep deleted file's inode information. Saves only starting block number, size and inode number i.e. only 20-100 bytes of space per deleted file.....

Seems AWESOME!! RIGHT !!

Removing specified file testfile1... 
testfile1 removed successfully.
[root@ngelinux ~]# 

 

b. Delete Directory

[root@ngelinux ~]# mkdir removedir1
[root@ngelinux ~]# echo hello > removedir1/file1
[root@ngelinux ~]# echo hello > removedir1/file2
[root@ngelinux ~]# echo hello > removedir1/file3
[root@ngelinux ~]# echo hello > removedir1/file4

[root@ngelinux ~]# delete removedir1/

You are running this command with root

This program DOES NOT GUARANTEE TO RECOVER ALL DATA
Whatever data is KEPT ON BLOCKS & NOT OVERWRITTEN BY KERNEL CAN BE RECOVERED

In case its overwritten then you will get the overwritten data and the old data can't be recovered unless you have backup :)
DO YOU STILL WANT TO CONTINUE ?
Press y to continue, any other key to quit.
y

Removing all files in the directory removedir1/
Removing specified file /root/removedir1/file1... 
/root/removedir1/file1 removed successfully.
Removing specified file /root/removedir1/file2... 
/root/removedir1/file2 removed successfully.
Removing specified file /root/removedir1/file3... 
/root/removedir1/file3 removed successfully.
Removing specified file /root/removedir1/file4... 
/root/removedir1/file4 removed successfully.
In the end removing directory structure /root/removedir1/
[root@ngelinux ~]# 

 

II. How to use undelete command to restore files?

[root@ngelinux ~]# undelete 
Starting now:
Enter the file name to search in Database for restore, or press enter to view all files ? 
    <Press return or enter key>

/root/testfile1 843622 1 18-Apr-2019  15:24:02
/root/removedir1/file1 592550 1 18-Apr-2019  15:26:01
/root/removedir1/file2 592551 1 18-Apr-2019  15:26:01
/root/removedir1/file3 592552 1 18-Apr-2019  15:26:01
/root/removedir1/file4 592553 1 18-Apr-2019  15:26:01
/usr/nglinux/filedata.txt (END)     <Press q to quit>

Enter the file name to search in Database for restore, or press enter to view all files ? 
test
Searching filenames containing the string test ....


Following files are found:
1. /root/testfile1 deleted on 18-Apr-2019 at 15:24:02 of size 4 KB
Enter the number of file which you want to try to restore or press Ctrl+C to exit ?
1

1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 0.000297156 s, 13.8 MB/s
File testfile1 restored at /tmp/testfile1... check if the contents are fine... else the data is over-written
[root@ngelinux ~]# 
[root@ngelinux ~]# cat /tmp/testfile1 
Welcome to delete command demo
[root@ngelinux ~]# 

 

III. How to use deleteperm command ?

a. Delete File

[root@ngelinux ~]# deleteperm /tmp/testfile1 

You are running this command with root

This program PERMANENTLY REMOVES ALL DATA
DATA CANT BE RECOVERED AFTER REMOVING THE FILE WITH THIS COMMAND.

All hard links & snapshots of the specified file/dir will automatically gets corrupted since it changes the data blocks referred by the file and then removes the file

Do you still want to continue (To PERMANENTLY remove THE FILE) ?
Press y to continue or any other key to quit.
y

Removing specified file /tmp/testfile1... 
/tmp/testfile1 removed successfully.

Now erasing the data blocks to permanently remove the file.
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 5.7275e-05 s, 71.5 MB/s
Blocks are zeroed successfully, as a safety measure shredding the file blocks again with zero and random data...
shred: /tmp/testfile1: pass 1/4 (random)...
shred: /tmp/testfile1: pass 2/4 (random)...
shred: /tmp/testfile1: pass 3/4 (random)...
shred: /tmp/testfile1: pass 4/4 (000000)...
Removing system cache..
vm.drop_caches = 3
SUCCESS !! File data blocks overwritten and file removed permanently
[root@ngelinux ~]# 

 

b. Delete Directory

[root@ngelinux ~]# deleteperm removedir4/

You are running this command with root

This program PERMANENTLY REMOVES ALL DATA
DATA CANT BE RECOVERED AFTER REMOVING THE FILE WITH THIS COMMAND.

All hard links & snapshots of the specified file/dir will automatically gets corrupted since it changes the data blocks referred by the file and then removes the file

Do you still want to continue (To PERMANENTLY remove THE FILE) ?
Press y to continue or any other key to quit.
y

Removing all files in the directory removedir4/
Removing specified file /root/removedir4/file5... 
/root/removedir4/file5 removed successfully.

Now erasing the data blocks to permanently remove the file.
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 5.3509e-05 s, 76.5 MB/s
Blocks are zeroed successfully, as a safety measure shredding the file blocks again with zero and random data...
shred: /root/removedir4/file5: pass 1/4 (random)...
shred: /root/removedir4/file5: pass 2/4 (random)...
shred: /root/removedir4/file5: pass 3/4 (random)...
shred: /root/removedir4/file5: pass 4/4 (000000)...
Removing system cache..
vm.drop_caches = 3
SUCCESS !! File data blocks overwritten and file removed permanently
Removing specified file /root/removedir4/file8... 
/root/removedir4/file8 removed successfully.

Now erasing the data blocks to permanently remove the file.
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 5.6959e-05 s, 71.9 MB/s
Blocks are zeroed successfully, as a safety measure shredding the file blocks again with zero and random data...
shred: /root/removedir4/file8: pass 1/4 (random)...
shred: /root/removedir4/file8: pass 2/4 (random)...
shred: /root/removedir4/file8: pass 3/4 (random)...
shred: /root/removedir4/file8: pass 4/4 (000000)...
Removing system cache..
vm.drop_caches = 3
SUCCESS !! File data blocks overwritten and file removed permanently
Removing specified file /root/removedir4/file9... 
/root/removedir4/file9 removed successfully.

Now erasing the data blocks to permanently remove the file.
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 5.4118e-05 s, 75.7 MB/s
Blocks are zeroed successfully, as a safety measure shredding the file blocks again with zero and random data...
shred: /root/removedir4/file9: pass 1/4 (random)...
shred: /root/removedir4/file9: pass 2/4 (random)...
shred: /root/removedir4/file9: pass 3/4 (random)...
shred: /root/removedir4/file9: pass 4/4 (000000)...
Removing system cache..
vm.drop_caches = 3
SUCCESS !! File data blocks overwritten and file removed permanently
In the end removing directory structure /root/removedir4/
[root@ngelinux ~]#