19 Storage, Filesystems & Backups Practice Questions & Answers
Every Storage, Filesystems & Backups practice question from the CompTIA Linux+ Practice Test, with the correct answer and a short explanation.
Start practice test →1. An administrator installs an unpartitioned 3 TB disk in a server and needs eight separate partitions on it. Which approach works?
- A.Write a GPT label with parted or gdisk, since GPT addresses the whole 3 TB and offers far more than four entries✓ Answer
- B.Write an MBR label with fdisk, make four primary partitions, then subdivide one of them into logical partitions
- C.Write an MBR label with fdisk, since the msdos scheme reaches any capacity once the partitions are 4096-byte aligned
- D.Run mkfs.ext4 straight onto /dev/sdb and use eight directories, since a whole-disk filesystem has no capacity ceiling
MBR (msdos) partition addressing stops at roughly 2 TiB and provides only four primary slots, one of which has to be spent on an extended partition to hold logical ones, so a 3 TB disk that needs eight partitions must use GPT. gdisk and parted both write GPT labels; fdisk is the legacy MBR tool.
Source: man 8 parted and man 8 gdisk (GPT versus msdos disk labels); CompTIA Linux+ objectives, storage management: partitioningReport a problem with this question
2. On a running server an administrator uses parted to add a partition to /dev/sdb, which already holds a mounted filesystem. parted reports success, but /dev/sdb4 never appears and lsblk does not list it. What explains this and fixes it?
- A.The partition type flag was never applied, so parted set 4 lvm on must run before the kernel registers it
- B.The kernel still holds the old table because the disk is in use, so partprobe /dev/sdb makes it re-read the table✓ Answer
- C.Partition device nodes are only generated during boot, so nothing shows up until the server has been restarted
- D.A filesystem has to exist first, so running mkfs.ext4 /dev/sdb4 is what creates the missing node under /dev
While any partition on a disk is in use the kernel cannot swap in the rewritten table, so it keeps serving its cached copy and the new device node is missing. partprobe (or partx) asks the kernel to re-read the partition table, after which the node appears; creating a filesystem or setting a type flag does not create device nodes.
Source: man 8 partprobe and man 8 partx (re-reading the partition table on a disk in use)Report a problem with this question
3. A team asks why the storage on a new server was built with LVM instead of plain partitions. Which statement describes the layer accurately?
- A.LVM mirrors every write onto a second disk by itself, which is why it removes the need for a redundant disk array
- B.A volume group is created on top of one logical volume, and the physical volumes are the filesystems that get mounted
- C.Each logical volume is just a partition renamed by LVM, so its size is still fixed by the partition table on the disk
- D.Disks become physical volumes, those are pooled into a volume group, and logical volumes are carved out and can grow later✓ Answer
LVM inserts an abstraction layer: pvcreate marks block devices as physical volumes, vgcreate pools their extents into a volume group, and lvcreate allocates logical volumes out of that pool. Because space is handed out in extents rather than as one contiguous disk region, a logical volume can be extended while it is in use, which a partition cannot. LVM itself adds no redundancy.
Source: man 8 lvm (physical volume, volume group and logical volume layers); man 8 pvcreate, man 8 vgcreate, man 8 lvcreateReport a problem with this question
4. An XFS logical volume /dev/vg01/lv01 mounted at /srv/data was enlarged with lvextend and lvs confirms the new size, but df -h still reports the old size. Which command finishes the job?
- A.resize2fs /dev/vg01/lv01, naming the device path of the volume
- B.xfs_growfs /srv/data, naming the mount point of the mounted filesystem✓ Answer
- C.xfs_growfs /dev/vg01/lv01, naming the device path of the volume
- D.xfs_repair /dev/vg01/lv01, after unmounting the filesystem first
xfs_growfs grows a mounted XFS filesystem and takes the mount point as its argument, while resize2fs is the ext2/3/4 tool and takes the device path; confusing the two is the usual mistake. xfs_repair neither grows nor works on a mounted filesystem, and XFS can be grown but never shrunk.
Source: man 8 xfs_growfs and man 8 resize2fs (argument each tool expects)Report a problem with this question
5. Before a risky database upgrade an administrator runs: lvcreate -s -L 10G -n db_snap /dev/vg01/db_lv. Which statement about the result is accurate?
- A.It stands in for an off-host backup, because the snapshot keeps working after the disks behind the volume group are lost
- B.It is a copy-on-write view on free extents of the same volume group, and it fails once its 10G of change space is used✓ Answer
- C.It freezes all writes to db_lv until it is deleted, so the database has to stay shut down for the whole life of the snapshot
- D.It is a self-contained duplicate of db_lv on the new extents, so the original volume group may afterwards be removed
An LVM snapshot stores only the previous contents of blocks that change after it was taken, and it draws that space from free extents in the same volume group; when the reserved space is exhausted the snapshot is invalidated. Because it shares the disks with its origin, it is a fast rollback point, not a backup.
Source: man 8 lvcreate (snapshot logical volumes and copy-on-write behaviour)Report a problem with this question
6. Four identical disks are available for a software array that must keep serving data after any two of them fail at the same time, with the most usable capacity that still meets that requirement. Which mdadm level fits?
- A.--level=0, striping across all four members, which yields the capacity of all four disks
- B.--level=5, single distributed parity, leaving the capacity of three of the four disks usable
- C.--level=6, dual distributed parity, which leaves the capacity of two of the four disks usable✓ Answer
- D.--level=10, mirrored pairs striped together, which survives any two failures in the set
RAID 6 keeps two independent parity computations, needs at least four members, and is the only common level that tolerates two simultaneous failures, at the cost of two disks' worth of capacity. RAID 5 tolerates one failure, RAID 10 survives two only when they fall in different mirrors, and RAID 0 has no redundancy at all.
Source: man 4 md and man 8 mdadm (RAID levels, minimum member counts and failure tolerance)Report a problem with this question
7. cat /proc/mdstat prints: md0 : active raid5 sdd1[3] sdc1[2] sdb1[1] 20953088 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_] What does this say, and what should be done next?
- A.A resynchronisation is under way, so the right action is to leave the array alone until the recovery has finished
- B.The array is healthy and the underscore marks an idle spare, so nothing is needed beyond saving mdadm --detail --scan
- C.The filesystem on md0 is corrupt, so the array has to be stopped and checked with fsck before any member is touched
- D.The array is degraded with one member missing and no redundancy left, so add a replacement with mdadm --manage --add✓ Answer
[4/3] means the array expects four members but only three are active, and the underscore in [UUU_] marks the empty slot. A RAID 5 in that state still serves data but has lost its parity protection, so a replacement device should be added to start a rebuild; if recovery were running, /proc/mdstat would also print a recovery line with a percentage.
Source: man 4 md (/proc/mdstat status fields) and man 8 mdadm (--manage --add)Report a problem with this question
8. A new logical volume has to be formatted as ext4 and carry the label backups so that /etc/fstab can mount it with LABEL=backups. Which approach achieves that?
- A.Run mkfs.ext4 -L backups on the volume, then confirm the label with blkid before writing the fstab line✓ Answer
- B.Run mkfs.ext4 -U backups on the volume, because -U stores the readable name that LABEL= looks up
- C.Run mkfs.ext4 on the volume, then record the mapping in /etc/labels, because LABEL= is resolved there
- D.Run mkfs.ext4 on the volume, then apply the name with xfs_admin -L backups, which labels any format
mkfs.ext4 -L writes the volume label into the ext4 superblock while the filesystem is being created, and e2label or tune2fs -L can change it later; blkid then reads LABEL and TYPE back so the fstab entry can be checked before a reboot. xfs_admin labels only XFS, -U sets a UUID rather than a label, and no /etc/labels file exists.
Source: man 8 mkfs.ext4 (-L label), man 8 e2label and man 8 blkidReport a problem with this question
9. dmesg reports metadata I/O errors on the XFS filesystem mounted at /var/lib/data, and it now has to be checked and repaired. What does that require?
- A.Run fsck /var/lib/data while it is mounted, since fsck.xfs carries out a full metadata check and fixes what it finds
- B.Unmount the filesystem and run xfs_repair on its device, because the tool refuses to touch a mounted filesystem✓ Answer
- C.Run xfs_repair on the mount point with the filesystem still mounted, because XFS replays its journal and repairs online
- D.Unmount the filesystem and run e2fsck -f on the device, since e2fsck is the generic checker for ext and XFS alike
xfs_repair rewrites metadata directly on the device, so it works only on an unmounted filesystem and exits with an error if the filesystem is still mounted. fsck.xfs exists purely so boot scripts have something to call: it checks nothing and exits successfully. e2fsck (fsck.ext4) handles only the ext family.
Source: man 8 xfs_repair (unmounted filesystem requirement) and man 8 fsck.xfs (does nothing and exits zero)Report a problem with this question
10. A new XFS data volume is added to /etc/fstab as: UUID=9c1e-4f2a /srv/data xfs defaults 0 1 Which field is wrong, and what should it hold?
- A.The fifth field, the dump flag; it has to be 1 so that the volume is included when filesystems are checked at boot
- B.The fourth field, the mount options; defaults cannot be used with XFS and has to be replaced with rw,relatime
- C.The sixth field, the fsck pass order; a non-root XFS volume belongs at 0 because fsck does not check XFS at boot✓ Answer
- D.The third field, the filesystem type; an XFS volume must be listed as auto so that mount detects the format itself
The sixth fstab field is the fsck pass order: 1 is reserved for the root filesystem, 2 is for other filesystems that are to be checked, and 0 skips the check. XFS is not checked by fsck at boot (fsck.xfs does nothing), so such entries conventionally carry 0. The fifth field is the dump flag and has nothing to do with checking.
Source: man 5 fstab (fs_freq and fs_passno fields)Report a problem with this question
11. A server has several SATA disks. The fstab line "/dev/sdc1 /backup ext4 defaults 0 2" mounted the wrong filesystem at /backup after another disk was added. What is the cause and the fix?
- A.The ext4 superblock stores the device path, so tune2fs has to rewrite it with the new name before the line works
- B.Kernel device names are handed out in detection order and can shift, so use the UUID= value that blkid reports✓ Answer
- C.The partition table was never re-read after the disk was added, so partprobe is needed and the line itself is fine
- D.Entries are processed alphabetically by mount point, so renaming /backup to /a_backup makes it resolve before others
Names such as /dev/sdc1 are assigned as the kernel enumerates devices, so adding, removing or recabling a disk can renumber them and an fstab line then points at a different partition. Identifying the filesystem by UUID= or LABEL= as reported by blkid or lsblk -f ties the entry to the filesystem itself instead of to its position in the detection order.
Source: man 5 fstab (identifying devices by UUID or LABEL) and man 8 blkidReport a problem with this question
12. A server dropped to emergency mode at boot because an external USB archive disk listed in /etc/fstab had been unplugged. The entry must stay so the disk is still mounted automatically whenever it is attached, but its absence must not stop the boot. Which change does that?
- A.Add nofail to that entry's options, so a missing device is reported and the rest of the boot carries on✓ Answer
- B.Add noauto to that entry's options, so the disk is never mounted at boot and has to be mounted by hand
- C.Set that entry's fsck pass field to 1, so a failed check on the device is repaired instead of being fatal
- D.Replace UUID= with /dev/sdd1 in that entry, so the mount is skipped quietly whenever that node is absent
nofail tells mount not to raise a boot-blocking error when the device behind an fstab entry is absent, so the system still reaches its normal target while the entry continues to mount the disk automatically when it is present. noauto would also let the boot finish but gives up automatic mounting, and the pass field only controls check order.
Source: man 8 mount (nofail and noauto mount options) and man 5 fstabReport a problem with this question
13. umount /mnt/archive returns "umount: /mnt/archive: target is busy." Which step is the correct response?
- A.Detach it with umount -l /mnt/archive, which is safe because pending writes are flushed before it goes
- B.Remount it with mount -o remount,ro /mnt/archive, which releases the descriptors held on the mount
- C.Force it with umount -f /mnt/archive, which closes the open file descriptors on the mount for you
- D.List what holds the mount open with fuser -vm /mnt/archive or lsof, then stop or move those processes✓ Answer
"Target is busy" means a process still has a file open or a working directory inside the mount, so the kernel will not detach it; fuser -vm or lsof names those processes so they can be stopped or moved out. umount -f is meant for unreachable network mounts, and umount -l only hides the mount until the last reference is closed, so neither removes the cause.
Source: man 8 umount (target is busy, -f and -l) and man 1 fuserReport a problem with this question
14. The files under /srv/media must also appear under /var/www/html/media on the same host, without copying the data, and the web server is configured to refuse to follow symbolic links. Which approach fits?
- A.mount --bind /srv/media /var/www/html/media, with a matching fstab entry that uses the bind option✓ Answer
- B.mount -t nfs localhost:/srv/media /var/www/html/media, with /srv/media published in /etc/exports
- C.mount -t tmpfs /srv/media /var/www/html/media, with a matching fstab entry of the tmpfs type
- D.mount -o loop /srv/media /var/www/html/media, with a matching fstab entry that uses the loop option
A bind mount attaches an existing directory subtree at a second place in the same filesystem namespace, so both paths reach the very same inodes with no copy and no symbolic link involved; in /etc/fstab the source directory is written in the device field and the line carries the bind option. tmpfs would mount empty RAM-backed storage there, and -o loop is for filesystem image files.
Source: man 8 mount (bind mounts) and man 5 fstabReport a problem with this question
15. A server is short of memory and 4 GiB of swap has to be added as a file on an existing ext4 filesystem, active immediately and again after a reboot. Which sequence does that?
- A.Create the file, set it to mode 0600, run mkswap on it, enable it with swapon, and add an fstab line of type swap✓ Answer
- B.Create the file, run mkswap on it, then raise vm.swappiness, which registers the file as swap for later boots too
- C.Create the file, run swapon on it directly, and list it in /etc/mtab so the kernel enables it at the next boot
- D.Create the file, run mkfs.ext4 on it, mount it under /swap, and add an fstab line of type ext4 with the sw option
A swap file has to be allocated, restricted to root-only access (mode 0600), written with a swap signature by mkswap, and activated with swapon; only an /etc/fstab line whose type field is swap brings it back after a reboot. vm.swappiness merely tunes how eagerly existing swap is used, and /etc/mtab reports current mounts rather than configuring anything.
Source: man 8 mkswap, man 8 swapon and man 5 fstab (swap entries)Report a problem with this question
16. On a server where /home is a separate ext4 filesystem, every user has to be limited in how much space they may consume there. Which mechanism does this?
- A.Give each account its own group and set the sticky bit on /home with chmod, which caps what one account writes
- B.Add a hard fsize limit for every user in /etc/security/limits.conf, which the kernel applies across the filesystem
- C.Reserve a share for every account with tune2fs -m on /home, which is the percentage each user may write there
- D.Mount /home with usrquota, build the quota files with quotacheck, enable them with quotaon, set limits with edquota✓ Answer
Disk quotas are a filesystem feature: the filesystem has to be mounted with usrquota (or grpquota), the accounting files are built by quotacheck and switched on with quotaon, and per-user soft and hard limits on blocks and inodes are then set with edquota, with repquota reporting usage. limits.conf caps the size of a single file a process may create, and tune2fs -m only reserves blocks for root.
Source: man 8 quotaon, man 8 edquota, man 8 repquota and man 5 fstab (usrquota and grpquota mount options)Report a problem with this question
17. The /etc tree has to be archived into /root/etc-backup.tar.bz2 in one command, and its contents listed later without extracting anything. Which pair of commands does that?
- A.tar -cJvf /root/etc-backup.tar.bz2 /etc to create it, then tar -tJvf /root/etc-backup.tar.bz2 to list it
- B.tar -cvf /root/etc-backup.tar /etc and bzip2 the result, then tar -xvf the archive to see what is inside
- C.tar -cjvf /root/etc-backup.tar.bz2 /etc to create it, then tar -tjvf /root/etc-backup.tar.bz2 to list it✓ Answer
- D.tar -czvf /root/etc-backup.tar.bz2 /etc to create it, then tar -xzvf /root/etc-backup.tar.bz2 to list it
tar picks the compressor by option letter: -z is gzip, -j is bzip2 and -J is xz, so a .tar.bz2 is produced with -j. Of the mode letters, -c creates, -t lists the table of contents without writing any file to disk, and -x extracts. Archiving (gathering many files into one stream) and compressing (shrinking that stream) are separate steps that tar can chain in a single command.
Source: man 1 tar (-c, -t, -x mode letters and -z, -j, -J compression options)Report a problem with this question
18. A nightly job must copy the /var/www tree to the host backup so that /srv/mirror holds exactly the current contents of /var/www - no www subdirectory, and files deleted on the source gone from the target - with permissions, ownership and timestamps preserved. Which command does that?
- A.rsync -rv --remove-source-files /var/www/ backup:/srv/mirror/, which mirrors the tree and clears out extra files
- B.rsync -a /var/www backup:/srv/mirror/, where a source without a trailing slash copies its contents into the target
- C.rsync -a --delete /var/www/ backup:/srv/mirror/, where the trailing slash copies the contents of the directory✓ Answer
- D.rsync -a --delete /var/www backup:/srv/mirror/, where the leading path is stripped so no www directory is created
A trailing slash on an rsync source means "the contents of this directory", while leaving it off copies the directory itself and creates /srv/mirror/www. The -a archive option recurses and preserves permissions, ownership, timestamps and symbolic links, and --delete removes files at the destination that no longer exist at the source, which is what makes the copy an exact mirror. --remove-source-files deletes from the source instead.
Source: man 1 rsync (trailing slash semantics on the source, -a archive mode and --delete)Report a problem with this question
19. A 500 GB partition /dev/sdb1 has to be copied block for block to /dev/sdc1 on the same host, including filesystem metadata and unused blocks, with progress shown. Which command is right, and what is the risk?
- A.dd of=/dev/sdb1 if=/dev/sdc1 bs=64K status=progress; the destination is always named by if=, so this order is right
- B.cp -a /dev/sdb1 /dev/sdc1; the archive option copies the block device contents along with the filesystem metadata
- C.dd if=/dev/sdb1 of=/dev/sdc1 bs=64K status=progress; transposing if= and of= would overwrite the source✓ Answer
- D.tar -cf - /dev/sdb1 | tar -xf - -C /dev/sdc1; piping two tar processes copies a partition block for block
dd reads from if= and writes to of=, duplicating a partition at block level - filesystem structures, free space and all - while status=progress reports as it runs. Because the two operands look alike, reversing them silently destroys the source, which is why a dd command is read twice before it is run. For a disk that is already returning read errors, ddrescue is the better tool: it retries and keeps a mapfile so the rescue can be resumed.
Source: man 1 dd (if, of, bs and status operands) and man 1 ddrescue (recovering from failing media)Report a problem with this question
Practice questions written to the published CompTIA Linux+ exam objectives and to standard Linux administration practice. CompTIA and Linux+ are marks of CompTIA, and Linux is a registered trademark of Linus Torvalds; this site is not affiliated with or endorsed by CompTIA. The real exam mixes multiple-choice items with performance-based questions that ask you to carry out a task in a simulated environment — those cannot be reproduced in a four-option format, so this bank covers the knowledge half and you should practise on a real system alongside it. CompTIA revises and version-numbers the objectives periodically: confirm the current objectives, exam code and requirements with CompTIA before testing. About the CompTIA Linux+ certification →