1

We have a Dell R420 with the Perc H710 Mini that was configured with 3 1TB drives in a RAID 5. I added another 1TB drive and thanks to a little help from the Dell discussion board, the RAID 5 reconfigured correctly and now has 2.47 TiB. I used the well-known tactic of simply opening Gparted and sliding the existing partition up to 1.9TB and used the lvextend -r -l +100%FREE command to get it there. But we'd like to use the rest of the unallocated disk space for our /home partition.

First I ran into this error:

parted ---pretend-input-tty /dev/sda resizepart 2  100%
Error: partition length of 5266759680 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295

I found this tip on SO, which says to create a new partition of the unallocated disk space

I tested that but kept running in this error:

lvextend -L1844.1G /dev/mapper/fedora_newserver-home
  Rounding size to boundary between physical extents: 1.80 TiB.
  Insufficient free space: 214489 extents needed, but only 0 available

From the tutorial:

Note that the -L parameter of lvextend indicates the total size of the Logical Volume, not the amount that the Logical Volume is extended

Am I misunderstanding the syntax here? You can see from fdisk the entire logical volume as 2.47 TB. I'm trying to add the newly available space to the home partition.

fdisk -l
Disk /dev/sda: 2.47 TiB, 2698581639168 bytes, 5270667264 sectors
Disk model: PERC H710
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: 0xa23c34a0

Device     Boot   Start        End    Sectors  Size Id Type
/dev/sda1  *       2048    3907583    3905536  1.9G 83 Linux
/dev/sda2       3907584 4006645759 4002738176  1.9T 8e Linux LVM

Another SF suggestion has an example of a single line command to achieve what I'm looking to do but wanted to see if there was a more preferred way.

I deleted that extra partition above in Gparted so I can try again.

By request:

pvs
      PV         VG              Fmt  Attr PSize PFree
      /dev/sda2  fedora_newserver lvm2 a--  1.86t    0

vgs
VG              #PV #LV #SN Attr   VSize VFree
fedora_newserver   1   5   0 wz--n- 1.86t    0

Thanks @NasirRiley! I had to slightly modify your instructions.

pvcreate /dev/sda3
WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sda3.
  Physical volume "/dev/sda3" successfully created.

Then:

vgextend fedora_newserver /dev/sda3
  Volume group "fedora_newserver" successfully extended

Next, didn't quite get us the entire unallocated space:

lvextend -l +100%FREE /dev/mapper/fedora_newserver-home
  Size of logical volume fedora_newserver/home changed from 1.21 TiB (317766 extents) to 1.80 TiB (472065 extents).
  Logical volume fedora_newserver/home successfully resized.

The next command errored:

xfs_growfs /dev/mapper/fedora_newserver-home xfs_growfs: /dev/mapper/fedora_newserver-home is not a mounted XFS filesystem

Then:

lvdisplay | sed -n '/home/,/Size/p'
  LV Path                /dev/fedora_newserver/home
  LV Name                home
  VG Name                fedora_newserver
  LV UUID                j94360-O22L-
  LV Write Access        read/write
  LV Creation host, time ourserver.edu, 2018-03-03 13:55:06 -0500
  LV Status              available
  # open                 1
  LV Size                1.80 TiB

We weren't quite there:

df -h
Filesystem                             Size  Used Avail Use% Mounted on
devtmpfs                                24G  4.0K   24G   1% /dev
tmpfs                                   24G   23M   24G   1% /dev/shm
tmpfs                                   24G  3.1M   24G   1% /run
/dev/mapper/fedora_newserver-root       280G   41G  240G  15% /
tmpfs                                   24G  4.2M   24G   1% /tmp
/dev/mapper/fedora_newserver-home       1.3T  859G  383G  70% /u/newserver
/dev/sda1                              1.9G  256M  1.5G  15% /boot
/dev/mapper/fedora_newserver-var        187G   73G  114G  39% /var
/dev/mapper/fedora_newserver-usr_local  187G   58G  129G  32% /usr/local

Here's what finally worked:

lvextend -r -l +100%FREE /dev/mapper/fedora_neweserver-home
  Size of logical volume fedora_newserver/home unchanged from 1.80 TiB (472065 extents).
  Logical volume fedora_newserver/home successfully resized.
meta-data=/dev/mapper/fedora_newserver-home isize=512    agcount=7, agsize=48828160 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=325392384, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=95367, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 325392384 to 483394560

Now we're there:

df -h|grep home
/dev/mapper/fedora_newserver-home       1.9T  860G  985G  47% /u/newserver

Not sure why the xfs command fails, we clearly are using XFS, perhaps it's being in a LVM?

From blkid:

/dev/mapper/fedora_newserver-home: LABEL="home" UUID="5aab1b3f-5cb5" TYPE="xfs"

OK the revised XFS command did NOT work:

    xfs_growfs /home
xfs_growfs: /home is not a mounted XFS filesystem

Duh, had to use the actual mount point:

xfs_growfs /u/newserver
meta-data=/dev/mapper/fedora_newserver-home isize=512    agcount=10, agsize=48828160 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=483394560, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=95367, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
RobbieTheK
  • 390
  • 5
  • 15
  • 2
    Add the output of `pvs` and `vgs` to your question. – Nasir Riley Mar 22 '20 at 03:30
  • @NasirRiley edited the original post. So the remaining space it still unpartitioned. – RobbieTheK Mar 22 '20 at 21:07
  • You should read the **upvoted** answer on the [question you linked](https://unix.stackexchange.com/a/67837/2823). the msdos partition table you are using has a physical limit of 2TB. For larger disks you need a GPT partition table. – Gerald Schneider Mar 23 '20 at 14:21

1 Answers1

0

As you can see from pvs and vgs, you don't have any space available in them to extend the fedora_newserver-home logical volume. You need to use parted (or fdisk) to create a new partition, /dev/sda3 with the rest of the space from /dev/sda. I'm taking it that you know how to do this considering that you created the other ones.

After that, create a new physical volume:

pvcreate /dev/sda3

Add it to the fedora_newserver volume group:

vgextend fedora_newserver /dev/sda3

And extend the fedora_newserver-home volume group to use the rest of the free space:

lvextend -l +100%FREE /dev/mapper/fedora_newserver-home
xfs_growfs /dev/mapper/fedora_newserver-home

(You may need to use it on the actual mountpoint. I assumed that it was home until you added it to your question.)

xfs_growfs /u/newserver

You can then see the increased space with:

lvs | grep home

Or:

lvdisplay | sed -n '/home/,/Size/p'
Nasir Riley
  • 2,035
  • 8
  • 9
  • Odd the last command didn't work: `xfs_growfs /dev/mapper/fedora_newserver-home xfs_growfs: /dev/mapper/fedora_newserver-home is not a mounted XFS filesystem`
    But results seem good: `lvdisplay | sed -n '/home/,/Size/p' LV Path /dev/fedora_newserver/home LV Name home VG Name fedora_newserver LV UUID j94360-O22L-Zsdx LV Write Access read/write LV Creation host, time ourserver.edu, 2018-03-03 13:55:06 -0500 LV Status available # open 1 LV Size 1.80 TiB`
    – RobbieTheK Mar 22 '20 at 22:48
  • @RobbieTheK You may need to use `xfs_growfs /home` which I've added to my answer as newer versions have to be run on the mounpoint. If my answer works for you, then you can accept it. – Nasir Riley Mar 22 '20 at 23:22
  • OK I accepted your solution and edited original post. The `-r` in `lvextend` seemed to be the difference. Thanks, have been on this for a week! – RobbieTheK Mar 22 '20 at 23:44
  • Hm actually the xfs_grow command failed--I was logged into another server when that command ran. I've updated the original post. @NasirRiley – RobbieTheK Mar 22 '20 at 23:53
  • any idea why the XFS command is still failing? – RobbieTheK Mar 23 '20 at 14:08
  • @RobbieTheK You have to run it on `/u/newserver` as that is the actual mountpoint. I assumed that it was mounted at `/home` before you added it to your question. I have updated the `xfs_growfs` part of my answer. – Nasir Riley Mar 23 '20 at 14:41
  • That was it! Updated in the original. Should've known to use the actual mount point. – RobbieTheK Mar 23 '20 at 16:09