XK0-006 practice question 3 of 15

A Linux administrator needs to securely erase the contents of a hard disk. Which of the following commands is the best for this task?

Full set: 149 questions
Answer options
A: sudo rm -rf /dev/sda1
B: sudo shred /dev/sda1 Correct answer
C: sudo parted rm /dev/sda1
D: sudo dd if=/dev/null of=/dev/sda1
Correct Answer:
B. sudo shred /dev/sda1
Explanation

The shred command is specifically designed to securely erase data from a file or device, making it extremely difficult to recover. It works by overwriting the specified target (in this case, the partition /dev/sda1) multiple times with complex patterns and, by default, a final pass of zeros. This process effectively destroys the magnetic remnants of the original data on traditional hard disk drives. For securely erasing a disk or partition, shred is the most appropriate and effective tool among the choices provided.

Why Incorrect

A. rm -rf only removes the filesystem's pointers to the data. The actual data remains on the disk and is easily recoverable until it is overwritten by new data.
C. parted rm removes a partition entry from the disk's partition table. It does not overwrite or erase the data that was stored within that partition.
D. dd if=/dev/null attempts to copy from /dev/null, which is an empty file, resulting in zero bytes being written. dd if=/dev/zero would perform a single-pass overwrite, which is less secure than shred.

References

1. GNU Project. (2020). GNU Coreutils Manual. Section 14.3 "shred: Remove files more securely". https://www.gnu.org/software/coreutils/manual/htmlnode/shred-invocation.html

2. The Linux man-pages project. (2021). shred(1) — overwrite a file to hide its contents, and optionally delete it. https://man7.org/linux/man-pages/man1/shred.1.html

3. Gutmann, P. (1996). Secure Deletion of Data from Magnetic and Solid-State Memory. Proceedings of the Sixth USENIX Security Symposium. (This paper provides the theoretical basis for the algorithms used by tools like shred). https://www.usenix.org/legacy/publications/library/proceedings/sec96/fullpapers/gutmann/

Scroll to Top