Free LPI LPIC-2 201-450 practice questions

10 free LPI LPIC-2 201-450 practice questions with the correct answer and a full explanation for each, taken from the CertStash pack of 120 questions. Work through them, then open each answer to check your reasoning.

Question 1

Which of the following commands erases the contents of the /dev/sdb3 partition?

  1. rm /dev/sdb3
  2. dd if=/dev/zero of=/dev/sdb3
  3. dd of=/dev/zero if=/dev/sdb3
  4. umount /dev/sdb3
Show answer and explanation

Correct answer: B. dd if=/dev/zero of=/dev/sdb3

The command 'dd if=/dev/zero of=/dev/sdb3' writes zeros from /dev/zero to the partition /dev/sdb3, effectively erasing its contents. The 'if' (input file) and 'of' (output file) parameters are in the correct order to overwrite the partition with zeros.

Why the other options are wrong

  • A. rm cannot directly erase block device partitions; it only removes file references.
  • C. This swaps the parameters, reading from /dev/sdb3 and writing into /dev/zero, which discards the data and erases nothing.
  • D. umount only unmounts a filesystem but does not erase its contents.

Question 2

Which of the following files will be looked for and used by GNU make, if one of them exists, unless a different file is specified on the command line when trying to compile software from source code? (Choose two.)

  1. configure
  2. config.h.in
  3. makefile
  4. Makefile
  5. Makefile.in
Show answer and explanation

Correct answer: C, D

C. makefile D. Makefile Without -f, GNU make searches the current directory for GNUmakefile, then makefile, then Makefile, using the first one found. Of the options, makefile and Makefile are default build files make will use.

Why the other options are wrong

  • A. configure is a shell script for configuration, not a make file.
  • B. config.h.in is a template configure uses to generate config.h, not a make build file.
  • E. Makefile.in is a template configure processes into Makefile; make does not use it directly.

Question 3

Which of the following commands restores only those files containing lpi in their name from the archive lpifiles.tar.gz?

  1. tar xvzf lpifiles.tar.gz –wildcards "˜*lpi*'
  2. tar xvzwf lpifiles.tar.gz "˜*lpi*'
  3. tar -xvfz lpifiles.tar.gz –deep "˜*lpi*'
  4. tar -xvzf lpifiles.tar.gz –subdirs "˜*lpi*'
  5. tar xvzf lpifiles.tar.gz –globbing "˜*lpi*'
Show answer and explanation

Correct answer: A. tar xvzf lpifiles.tar.gz –wildcards "˜*lpi*'

The command 'tar xvzf lpifiles.tar.gz –wildcards "*lpi*"' extracts from a gzipped tar archive only the members matching the pattern '*lpi*'. The –wildcards option enables pattern matching, and the flags x (extract), v (verbose), z (gzip), and f (file) are correctly ordered.

Why the other options are wrong

  • B. The w flag means –interactive, prompting for confirmation, not pattern matching.
  • C. There is no –deep option in tar.
  • D. –subdirs is not a valid tar option.
  • E. –globbing does not exist; –wildcards is the correct option.

Question 4

A regular user has just run –

./configure && make && make install to build and install a program. However, the installation fails.

What could be done to install the program? (Choose two.)

  1. Install the binaries manually with suinstall
  2. Run make install with root privileges
  3. Do not run ./configure in order to maintain the default configuration for correct installation
  4. Rerun ./configure with a –prefix option where the user has permissions to write
  5. Run make install_local to install into /usr/local/
Show answer and explanation

Correct answer: B, D

B. Run make install with root privileges D. Rerun ./configure with a –prefix option where the user has permissions to write Running 'make install' with root privileges (sudo) bypasses permission restrictions and installs to default system directories. Alternatively, using './configure –prefix=/path/with/user/permissions' allows the regular user to install the program in a directory where they have write access without requiring root privileges.

Why the other options are wrong

  • A. suinstall is not a standard Linux command for installing binaries.
  • C. Skipping ./configure would not fix permission issues and would likely cause the build to fail or use incorrect defaults.
  • E. make install_local is not a standard make target; this option does not exist.

Question 5

The following command has just been run successfully:

Cd /opt; tar xvf /dev/nst0;

What will happen if the command sequence is run again?

  1. An error saying that there is no tape present is generated because the tape has been ejected after being used
  2. The contents of /opt will be restored again
  3. The entire contents of /opt will be replaced with the contents of the next file on the tape
  4. The contents of /opt will have additional content added from the next file on the tape
Show answer and explanation

Correct answer: D. The contents of /opt will have additional content added from the next file on the tape

Tape devices like /dev/nst0 are sequential access devices that maintain a file pointer position. After extracting the first tar archive, the tape pointer advances to the next file. Running the command again reads the next file on the tape and extracts its contents into /opt, adding to what already exists rather than replacing it.

Why the other options are wrong

  • A. Tapes do not automatically eject after use; the non-rewinding device /dev/nst0 keeps the tape in position.
  • B. The contents will not simply be restored again; the tape pointer has advanced to the next file.
  • C. The contents are added to /opt, not replaced entirely, because both tar files extract sequentially into the same directory.

Question 6

Which single command simulates a failed device within a RAID 5 array?

  1. mdadm –remove /dev/md0 /dev/sdd1
  2. mdadm –zero-superblock /dev/sdf3
  3. mdadm –force-fault /dev/md2 /dev/sde2
  4. mdadm –fail /dev/md0 /dev/sdc1
  5. mdadm /dev/md0 –offline /dev/sdc1
Show answer and explanation

Correct answer: D. mdadm –fail /dev/md0 /dev/sdc1

The command 'mdadm –fail /dev/md0 /dev/sdc1' marks the device /dev/sdc1 in the RAID array /dev/md0 as failed, simulating a device failure. This is the correct mdadm syntax for marking a disk as faulty within an array.

Why the other options are wrong

  • A. The –remove option removes a device from an array; it does not simulate a failure state.
  • B. The –zero-superblock option erases the RAID superblock; it does not mark a device as failed.
  • C. The –force-fault option does not exist in mdadm.
  • E. mdadm has no –offline option, so this command is rejected as an unrecognized option.

Question 7

What is the minimum number of disks required in a fully redundant RAID5 array?

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
Show answer and explanation

Correct answer: C. 3

RAID 5 requires a minimum of 3 disks to function. It stripes data across disks and uses distributed parity to provide redundancy. With 3 disks, one disk worth of capacity is used for parity information, allowing recovery from a single disk failure.

Why the other options are wrong

  • A. One disk provides no redundancy and is not a valid RAID configuration.
  • B. Two disks cannot provide the striping and parity protection that RAID 5 requires.
  • D. While 4 disks is a valid RAID 5 configuration, the minimum requirement is 3 disks.
  • E. Five disks is a valid configuration but exceeds the minimum requirement.

Question 8

A system has one hard disk and one CD writer which are both connected to SATA controllers.

Which device represents the CD writer?

  1. /dev/hdb
  2. /dev/sdd
  3. /dev/scd1
  4. /dev/sr0
  5. /dev/sr1
Show answer and explanation

Correct answer: D. /dev/sr0

A SATA-connected CD writer is represented by /dev/sr0, where 'sr' stands for SCSI C-OM. SATA devices use the SCSI subsystem for CD/DVD drives. The first such device is numbered 0, making /dev/sr0 the correct device file.

Why the other options are wrong

  • A. /dev/hdb represents an IDE hard drive, not a SATA device or CD writer.
  • B. /dev/sdd would represent a SATA hard disk drive, not a CD writer.
  • C. /dev/scd1 is an alternate naming scheme for SCSI CD devices, but it would represent the second device; the first is typically /dev/sr0.
  • E. /dev/sr1 would represent the second SCSI CD-ROM device, not the first CD writer on the system.

Question 9

What action should be performed after increasing the size of a logical volume?

  1. Run vgresize
  2. Increase the size of the filesystem used for the logical volume
  3. Run 1vresize
  4. Remount the logical volume
Show answer and explanation

Correct answer: B. Increase the size of the filesystem used for the logical volume

After increasing the size of a logical volume with lvextend or lvresize, the filesystem contained within that volume must be expanded to use the newly available space. Commands like resize2fs (for ext filesystems) or xfs_growfs (for XFS) are required to grow the filesystem to match the logical volume size. Without this step, the additional space remains unused by the filesystem.

Why the other options are wrong

  • A. vgresize is not a valid LVM command; volume group resizing is not the appropriate action after expanding a logical volume.
  • C. lvresize is used to change the logical volume size itself, not the action performed after resizing.
  • D. Remounting alone does not expand the filesystem to use the new logical volume space; filesystem expansion commands are required.

Question 10

Which command is used to make an exact copy, at a single point in time, of a logical volume while still allowing the original logical volume to be updated?

  1. lvcclone
  2. lvcreate
  3. lvm2
  4. lvsnap
  5. lvsnapshot
Show answer and explanation

Correct answer: B. lvcreate

The lvcreate command is used to create logical volume snapshots when invoked with the -s or –snapshot option. This creates a point-in-time copy of a logical volume while allowing the original to continue being updated. Snapshots use copy-on-write technology to track changes efficiently.

Why the other options are wrong

  • A. lvcclone is not a valid LVM command.
  • C. lvm2 is the package/suite name, not a command for creating snapshots.
  • D. lvsnap is not a valid LVM command.
  • E. lvsnapshot is not a valid LVM command; the correct command is lvcreate with snapshot options.

That was 10 of 120.

The full LPI LPIC-2 201-450 pack has all 120 questions, each with the answer, the explanation and why the other options are wrong, plus a questions-only copy for timed runs. US$39, paid once, with free monthly updates and a pass-or-your-money-back guarantee.

Get the full pack