How do I completely wipe my hard drive in Ubuntu?: wipe, srm, scrub, shred and dd.

29/12/2020
Usually Linux users use the command rm to remove files and directories. When we remove a file using the command rm we are labeling the removed file or directory as “rewritable space” on the disk. Therefore the removed data can be restored if wasn’t overwritten by another piece of data as explained in previous articles on computer forensics and data recovery.

In this tutorial 5 tools to carry out a full removal of data, wipe, srm, dd, shred and scrub are shown. The programs can be executed from live cd distributions to wipe the hard drive completely.

WIPE

The wipe command allows us to fully erase data from our disk, it rewrites the sector and flushes the cache making it impossible or very difficult to retrieve the data.

To install wipe on Debian/Ubuntu type:

apt install wipe -y

The wipe command is useful to remove files, directories partitions or disk.

To remove a single file using wipe type:

wipe filename

To report on progress type:

wipe -i filename

To wipe a directory type:

wipe -r directoryname

To wipe a partition or disk speeding up the process add the parameter -q,  type:

wipe -q /dev/sdx

Note: replace sdx for the proper device.

The last example will wipe everything from the disk or partition without possibility to restore it, type man wipe in the terminal to see all options available.

SRM

srm overwrites the data before deleting it, it is a similar option to wipe. To install srm on Debian or Ubuntu type:

apt install secure-delete

Type man srm to see the available options

As you can see similarly to rm you can use

To remove a file:

srm filename

To remove a directory:

srm -r directory

For additional information on srm type:

man srm

DD

DD can be used to overwrite a disk. If you formatted a disk you can run the following command to fill the disk with  random data, making it impossible to restore. Replace the X for the proper disk. Dd overwrites the disk with zero and allows us to format the device in different formats. It comes by default on Debian and Ubuntu based distributions.

To fill a disk with random data using dd run:

dd if=/dev/urandom of=/dev/sdX bs=4k

For additional information on shred on the terminal type:

man dd

SHRED

Shred is another alternative to safely remove data, it comes by default on Debian/Ubuntu if it doesn’t type:

apt install coreutils

Shred is simple to use too, to overwrite  a file just type:

shred <filename>

After an ls we see the directory is still there,it was overwritten, to remove it after writing add the -u parameter:

As you can see after the -u there is not linuxhintshred directory.

For additional information on shred type:

man shred

Scrub

Scrub is another tool to overwrite data in hard disks, Scrub writes patterns on files or devices making the data retrieval more difficult. Scrub works in 3 modes detailed in the main page, the default mode is the most effective one.

to install Scrub run:

apt install scrub

Type

man scrub

As the man says we can wipe a disk by running:

scrub /dev/sdX

To create a directory and fill it with files until the system is full run:

scrub -X <directoryName>

For additional information on Scrub option and parameters, in the console type:

man scrub

I hope you found this tutorial useful to get your data fully removed, should you have any inquiry contact us opening a ticket support at LinuxHint Support. Keep following LinuxHint for more tips and updates on Linux.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to use parted on Linux

Parted is a command line tool for managing disk partitions on Linux. Parted can be used to work with both MSDOS and GPT...
29/12/2020

Meet the Self-Hosted Movement

Cloud adoption rates have been growing for many years now, with 73 percent of companies planning to move to a fully software-defined...
28/12/2020

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo

Thuê proxy ipv4 IPv4 Chất Lượng Cao Tại ONET.COM.VN: Tránh Quét Tài Khoản Zalo Và Đảm Bảo An Toàn Trên...
02/01/2024
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024