Linux+ Filesystem and Storage Management Flashcards
6 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Linux+ Filesystem and Storage Management flashcards as text
A system administrator needs to add a new disk, /dev/sdc, to an existing LVM volume group named 'vg_data' and then use all the new space to extend the logical volume '/dev/mapper/vg_data-lv_apps'. Which of the following command sequences is the correct way to accomplish this?
Answer: pvcreate /dev/sdc && vgextend vg_data /dev/sdc && lvextend -l +100%FREE /dev/mapper/vg_data-lv_apps && resize2fs /dev/mapper/vg_data-lv_apps
The correct process involves four steps in order: 1. Initialize the new disk as a physical volume for LVM use with `pvcreate`. 2. Extend the existing volume group to include the new physical volume with `vgextend`. 3. Extend the logical volume to use the newly available free space in the volume group with `lvextend -l +100%FREE`. 4. Resize the filesystem on the logical volume to recognize and use the new space with `resize2fs` (for ext4 filesystems).
A system administrator wants to ensure an XFS filesystem on the partition identified by UUID 'a1b2c3d4-e5f6-7890-1234-56789abcdef0' is automatically mounted to `/mnt/archive` at boot. Which of the following lines is correctly formatted for `/etc/fstab`?
Answer: UUID=a1b2c3d4-e5f6-7890-1234-56789abcdef0 /mnt/archive xfs defaults 0 0
The standard format for an /etc/fstab entry is: . The correct answer follows this format, using the UUID to identify the device, followed by the mount point, filesystem type, standard options ('defaults'), and the appropriate dump (0) and pass (0) values for a non-root data filesystem.
A user reports the `/home` filesystem is nearly full. Which command would be most effective for a system administrator to identify the specific subdirectories within `/home/someuser` that are consuming the most disk space?
Answer: du -sh /home/someuser/* | sort -rh
The `du -sh /home/someuser/*` command calculates the disk usage (`du`) in a summarized (`-s`) and human-readable (`-h`) format for each item in the `/home/someuser` directory. Piping this output to `sort -rh` sorts the results numerically in reverse (largest first) human-readable format, making it easy to see the largest directories at the top. `df` shows partition-level usage, not directory-level.
A Linux server has failed to boot, dropping to an emergency shell. The administrator determines the root filesystem on `/dev/sda2` has errors and needs to be repaired. The filesystem is currently unmounted. Which command should be used to automatically attempt to fix any detected errors non-interactively?
Answer: fsck -p /dev/sda2
The `fsck` command is used to check and repair filesystems. The `-p` (preen) option causes `fsck` to automatically repair any filesystem problems that can be safely fixed without user intervention. This is often preferred in scripts or recovery scenarios to avoid manual prompts. The `-y` flag is another common alternative that assumes 'yes' to all prompts.
A system administrator has created a new partition, `/dev/sdb3`, to be used as additional swap space. What is the correct command to prepare this partition for use as swap before it can be enabled?
Answer: mkswap /dev/sdb3
The `mkswap` command is used to set up a Linux swap area on a device or in a file. This command initializes the partition with the necessary signature and metadata to be recognized as swap space. Only after running `mkswap` can the `swapon` command be used to activate it.
An administrator executes the command `mount -o remount,ro /data` on a filesystem that is currently mounted as read-write. What is the effect of this command?
Answer: The filesystem's mount options will be changed to read-only without unmounting it.
The `remount` option for the `mount` command allows an administrator to change the mount flags of an already-mounted filesystem without unmounting and remounting it. In this case, it changes the status of the `/data` mount point from its current state to read-only (`ro`).