Forrest logo
back to the lvresize tool

lvresize:tldr:55346

lvresize: Reduce the size of a logical volume as well as the underlying filesystem by 120 GB.
$ lvresize --size -${120G} --resizefs ${volume_group}/${logical_volume}
try on your machine

The command lvresize is used to resize a logical volume in a Linux system.

Here's an explanation of the options used in the command:

  • --size -${120G}: Specifies the new size for the logical volume, which is calculated by subtracting 120 gigabytes (120G) from the current size. The minus sign (-) before ${120G} indicates that the size is being decreased.

  • --resizefs: This option instructs lvresize to also resize the file system within the logical volume after resizing it. This ensures that the file system can utilize the available space.

  • ${volume_group}: This is a placeholder for the name of the volume group that contains the logical volume you want to resize. You need to replace ${volume_group} with the actual name of the volume group.

  • ${logical_volume}: This is a placeholder for the name of the logical volume you want to resize. You need to replace ${logical_volume} with the actual name of the logical volume.

To summarize, the command lvresize --size -${120G} --resizefs ${volume_group}/${logical_volume} resizes the specified logical volume by reducing its size by 120 gigabytes and also resizes the file system within the logical volume to utilize the changed size.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lvresize tool