• 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. How to check the PHP version on Linux
  2. initctl Command Examples in Linux
  3. ‘lxc_cgfs – Device or resource busy – failed to set memory.use_hierarchy to 1; continuing’ – error while starting LXC container
  4. dpkg-reconfigure Command Options
  5. mailq Command Examples in Linux
  6. lshal Command Examples in Linux
  7. Linux OS service ‘auditd’
  8. How to install and Configure VNC (TigerVNC) server in CentOS / RHEL 7
  9. How to determine file and free space fragmentation of OCFS2
  10. How to set ulimit values for a systemd service

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright