We have old Linux machines with RHEL7.2
and others with RHEL7.6
We want to resize the partition sda2
and then grow the filesystem. ( as /var or root filesystem )
The thing is that we succeeded to do it on RHEL7.6
machines or any higher version then RHEL7.2
, but the same exactly command give's exception when machine is RHEL7.2
Here is example on RHEL 7.6
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 180G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
├─VG-LAB_root 253:0 0 20G 0 lvm /
├─VG-LAB_swap 253:1 0 15.6G 0 lvm [SWAP]
└─VG-LAB_var 253:2 0 30G 0 lvm /var
more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
# parted /dev/sda resizepart 2 100%
Information: You may need to update /etc/fstab.
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 180G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 179G 0 part
├─VG-LAB-lv_root 253:0 0 20G 0 lvm /
├─VG-LAB-lv_swap 253:1 0 15.6G 0 lvm [SWAP]
└─VG-LAB-lv_var 253:2 0 30G 0 lvm /var
As we can see above sda2
resized to 179G from 99G as expected
But when we did the same command on RHEL7.2
with the same filesystem and partitions size then its gives the following like usage problem
more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
parted /dev/sda resizepart 2 100%
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, run in
interactive mode.
OPTIONs:
-h, --help displays this help message
-l, --list lists partition layout on all block devices
-m, --machine displays machine parseable output
-s, --script never prompts for user intervention
-v, --version displays the version
-a, --align=[none|cyl|min|opt] alignment for new partitions
So what is the different between running parted /dev/sda resizepart 2 100%
on RHEL7.2
VS Higher versions like RHEL7.6
that passed?
And what is the correct syntax in order to resize sda2
on RHEL 7.2 machines?
more info from our machines
# parted --version
parted (GNU parted) 3.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by <http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
# resizepart --version
resizepart from util-linux 2.23.2