• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

resize2fs Command Examples in Linux

by admin

The resize2fs command is used to enlarge or shrink an ext2/3/4 file system on a device. You can enlarge a mounted file system, but you must unmount the file system before you can shrink it. You can specify the desired size of the file system in order to either enlarge or shrink it. If you don’t specify a size, the file system will be resized to the same size as the partition.

It’s important to note that resize2fs does not resize partitions, only the file system. You must use a command like fdisk or an LVM tool to expand the size of the partition/ volume first in order to then enlarge the file system.

Syntax

The syntax of the resize2fs command is:

# resize2fs [options] {device/file system name} [desired size]

resize2fs Command Examples

1. To resize a recently extended file system:

# resize2fs /dev/mapper/VG02-LV05 

2. To forcefuly resize the file system:

# resize2fs -f /dev/mapper/VG02-LV05 

3. To flush the filesystem device’s buffer caches:

# resize2fs -F /dev/mapper/VG02-LV05 

4. To shrink the filesystem to the minimum size:

# resize2fs -M /dev/mapper/VG02-LV05 

5. To prints out a percentage completion bars for each resize2fs operation:

# resize2fs -p /dev/mapper/VG02-LV05 

6. To Print the minimum size of the filesystem and exit:

# resize2fs -P /dev/mapper/VG02-LV05 

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : How to modify Network Interface names
  2. Disk Encryption Using Network Based Key Services (NBDE) on CentOS/RHEL 8
  3. How to control resource (cgroup) with systemd for user process group in CentOS/RHEL 7
  4. wc: command not found
  5. CentOS / RHEL 7 : GRUB2 configuration file /boot/grub2/grub.cfg explained
  6. asterisk: command not found
  7. CentOS / RHEL : How to add swap file
  8. Shell Script to print pyramid of Stars
  9. vgcreate Command Examples in Linux
  10. How to Add Locale on CentOS/RHEL 8

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright