XK0-005 · Question #1204
A raw VM image is being compressed with bzip2 and copied to a flash drive at /dev/hdb for off- site use by the marketing department. Which of the following command lines accomplishes this task?
The correct answer is B. bzip2 -c /vm/mktg.img | dd of=/dev/hdb. Option B is correct: 'bzip2 -c /vm/mktg.img' compresses the image and writes the compressed data to standard output (the -c flag). This output is piped to 'dd of=/dev/hdb', which writes the raw bytes directly to the block device. This is the correct way to compress and write an…
Question
Options
- Amv /vm/mkgt.img | bzip2 /dev/hdb/mkgt.img.bz2
- Bbzip2 -c /vm/mktg.img | dd of=/dev/hdb
- Ccp /vm/mktg.img | bzip2 /dev/hdb/mktg.img.bz2
- Dcp -a -r /vm/mktg.img bzip2 /dev/hdb/mktg.img.zip
How the community answered
(42 responses)- A5% (2)
- B71% (30)
- C14% (6)
- D10% (4)
Explanation
Option B is correct: 'bzip2 -c /vm/mktg.img' compresses the image and writes the compressed data to standard output (the -c flag). This output is piped to 'dd of=/dev/hdb', which writes the raw bytes directly to the block device. This is the correct way to compress and write an image to a raw device in one step. Options A and C misuse 'mv' and 'cp' - these commands do not write to stdout, so piping them is invalid. Option D treats 'bzip2' as a directory path argument to 'cp', which is entirely incorrect syntax.
Topics
Community Discussion
No community discussion yet for this question.