What command allows you to expand or shrink a file system in Linux?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command that allows you to expand or shrink a file system in Linux is "resize2fs." This utility works specifically with ext2, ext3, and ext4 file systems, enabling administrators to adjust the file system size without needing to unmount it, provided that the file system is not currently in use. When increasing the size of a file system, resize2fs can read the underlying block device to expand the file system to utilize free space. Conversely, when shrinking a file system, it performs the necessary checks to ensure data integrity and safely reduces its size.

The other options serve different purposes: "e2label" is used for modifying the label of an ext2/ext3/ext4 file system but does not affect size. "du" stands for disk usage, providing an estimate of file space usage in a directory, while "df" reports on available and used disk space on file systems, but neither of these commands can resize a file system. Thus, resize2fs is the appropriate and specific command for the task of expanding or shrinking a file system.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy