0

I have a standard parition and lvm partition on my disk /dev/sda

[root@server1 ~]# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3ab97747

Device     Boot   Start      End  Sectors Size Id Type
/dev/sda1  *       2048  2099199  2097152   1G 83 Linux
/dev/sda2       2099200 20971519 18872320   9G 8e Linux LVM

My total disk space is 10G and I want to reduce size of /dev/sda2 and create another standard partition /dev/sda3

[root@server1 ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               462M     0  462M   0% /dev
tmpfs                  490M     0  490M   0% /dev/shm
tmpfs                  490M  7.6M  483M   2% /run
tmpfs                  490M     0  490M   0% /sys/fs/cgroup
/dev/mapper/rhel-root  8.0G  4.2G  3.9G  52% /
/dev/sda1             1014M  210M  805M  21% /boot
tmpfs                   98M  1.2M   97M   2% /run/user/42
tmpfs                   98M  4.6M   94M   5% /run/user/1000
[root@server1 ~]#

[root@server1 ~]# vgdisplay -v
  --- Volume group ---
  VG Name               rhel
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <9.00 GiB
  PE Size               4.00 MiB
  Total PE              2303
  Alloc PE / Size       2303 / <9.00 GiB
  Free  PE / Size       0 / 0
  VG UUID               ScT2gM-r4Vl-7FVv-cyoh-6FJq-fcNU-Z7Wobk

  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                jLX6Kp-KV68-vH9V-MCG0-quZK-grC2-PguTOC
  LV Write Access        read/write
  LV Creation host, time server1, 2020-07-17 23:47:10 -0500
  LV Status              available
  # open                 2
  LV Size                1.00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                F3uUAt-QgLv-YZ62-k8wb-lxPn-UYa8-gQz8Pe
  LV Write Access        read/write
  LV Creation host, time server1, 2020-07-17 23:47:11 -0500
  LV Status              available
  # open                 1
  LV Size                <8.00 GiB
  Current LE             2047
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Physical volumes ---
  PV Name               /dev/sda2
  PV UUID               020htj-f95F-i3O5-Dh3j-4yWc-EbU0-yYKkFY
  PV Status             allocatable
  Total PE / Free PE    2303 / 0

I have tried using lvreduce but getting:

[root@server1 ~]# lvreduce /dev/sda2
  No command with matching syntax recognised.  Run 'lvreduce --help' for more information.
  Correct command syntax is:
  lvreduce -L|--size [-]Size[m|UNIT] LV

I am fine with loosing some of the data as it is a test server only but not to the extent that I am unable to run linux commands

meallhour
  • 111
  • 2
  • You can't reduce its size because it is all in use. Technically you could, but you would lose your data. And you can't shrink an XFS filesystem at all. Please confirm that you are OK with losing all your data. Of course, at this point you may as well just reinstall the OS and partition it the way you want. – Michael Hampton Jul 18 '20 at 17:50
  • I am fine with `loosing some of the data` as it is a test server only but not to the extent that I am unable to run linux commands – meallhour Jul 18 '20 at 17:58
  • 1
    You can lose none or all of it. Take your pick. You really should just back up anything important and reinstall. – Michael Hampton Jul 18 '20 at 18:26

0 Answers0