XK0-004 · Question #382
A system administrator has discovered a drive is malfunctioning and needs to be replaced in a server. The administrator lists properties of the exiting storage before attempting the replacement…
The correct answer is B. Fdis.dev/sdb< echo p; echo d; eacho w). After replacing a malfunctioning drive, fdisk with piped interactive commands is used to recreate the correct partition table on the new device based on the previously documented layout.
Question
A system administrator has discovered a drive is malfunctioning and needs to be replaced in a server. The administrator lists properties of the exiting storage before attempting the replacement:
After replacing the malfunctioning drive, which of the following is the BEST way to create the proper partition table on the new drive?
Options
- AParted -a optimal /dev/sdb primary 0% 2000MB
- BFdis.dev/sdb< echo p; echo d; eacho w)
- CMkpart primary 1MB 2000MB /dev/sdb
- DSfdisk -dev/sda| sfdisk/dev/sdb
How the community answered
(51 responses)- A14% (7)
- B75% (38)
- C8% (4)
- D4% (2)
Why each option
After replacing a malfunctioning drive, fdisk with piped interactive commands is used to recreate the correct partition table on the new device based on the previously documented layout.
The parted command shown is invalid - parted requires a subcommand such as 'mkpart' and the syntax 'parted -a optimal /dev/sdb primary 0% 2000MB' is not a recognized parted command form.
Using fdisk /dev/sdb with piped echo commands allows the administrator to feed interactive keystrokes (print, delete, new, write) directly to fdisk, scripting the recreation of the partition layout documented from the original drive. This approach gives precise control over partition type, start/end sectors, and alignment when rebuilding a table from known specifications. It is a standard method for scripted partition table creation on Linux systems where sfdisk input is not available.
The mkpart subcommand belongs to parted and cannot be called as a standalone command; the device must be passed to parted itself, not appended after the size argument.
The sfdisk syntax shown ('Sfdisk -dev/sda') is malformed - the dump flag is '-d' followed by a space and the device path, and this approach also requires the source drive to still be accessible and readable.
Concept tested: Linux partition table recreation using fdisk scripted input
Source: https://man7.org/linux/man-pages/man8/fdisk.8.html
Topics
Community Discussion
No community discussion yet for this question.