Questão de Linux Administration #019e3987
D.
dd if=/dev/zero of=/dev/sda bs=440
Which of the following commands can be used to create a USB storage media from a disk image?
gdisk
dd
cc
fdisk
mount
Explicação Oficial / Explicações da Comunidade
Summary
The question asks which command can create a USB storage media from a disk image. The correct answer is dd. dd is a powerful utility for low-level copying and conversion of data, commonly used to write disk images (like .iso or .img files) directly to USB drives or other block devices. The example command dd if=/dev/zero of=/dev/sda bs=440 shows a typical dd syntax: if specifies the input file (the disk image), of specifies the output file (the target device, e.g., /dev/sdb), and bs sets the block size. This command copies the image byte-for-byte, making it ideal for creating bootable USB media.
How it Works
dd operates at the block device level, directly reading from the input file and writing to the output device without interpreting filesystem structures. It uses the kernel's block I/O subsystem to perform raw reads and writes. When writing a disk image to a USB drive, dd copies the entire image, including partition tables, boot sectors, and filesystem data, preserving the exact layout. This is essential for bootable media because the image contains a complete, pre-configured system. The bs parameter controls the number of bytes read/written per operation, affecting performance. A typical command for creating a bootable USB is dd if=image.iso of=/dev/sdX bs=4M status=progress.
Why the correct answer is right
dd is the standard tool for this task because it performs a direct, bit-for-bit copy of the disk image to the target device. It does not require the target to be formatted or mounted; it writes over any existing data. This is exactly what is needed to create a bootable USB from an ISO or IMG file. The command in the question (dd if=/dev/zero of=/dev/sda bs=440) is a variant that writes zeros to the first 440 bytes of /dev/sda (the Master Boot Record), but the same tool is used for writing images.
Why incorrect options are wrong
- A. gdisk:
gdiskis a partitioning tool for GPT disks. It can create, modify, and delete partitions, but it cannot write a raw disk image to a device. It operates on partition tables, not on the entire device content. - C. cc:
ccis typically an alias for the C compiler (e.g.,gcc). It has nothing to do with disk operations or image writing. - D. fdisk:
fdiskis a partition table manipulator. Likegdisk, it can manage partitions but cannot write a disk image. It works on the partition level, not on raw device data. - E. mount:
mountattaches a filesystem to the directory tree. It requires an existing filesystem on the device and cannot create a bootable USB from an image. Mounting an image file (via loop device) is possible, but that is not writing to a USB.