So your GroupWise disk is running out of space and you need to increase the size in the simplest and most direct way possible. Great news, this can be done fairly easily and with minimal downtime.
I used to count on the live linux distribution "gparted" to perform a myriad of disk partitioning tasks, including resizing xfs partitions. However, recently I have experienced some massive disc corruption as a result of this tool. When encountering an issue resizing a disk, it's generally on a production system and I do not have the luxury of spending hours trying to determine the cause. So I have found other ways to accomplish the task with native SLES toolsets.
Important things to know.
- This covers resizing an XFS file system on SLES 12 or SLES 15. If you're using a different partitioning configuration, do not follow this process/method.
- This will require downtime, so plan accordingly.
- You should shut down groupwise and any processes running on the partition you are resizing.
- You will need to unmount the partition, it cannot be active when doing the initial partition operation.
- You should take a vm snapshot before performing any disk operations, as a precaution and fail-back just in case it goes badly.
- You will use two tools, "parted" and "xfs_growfs".
- I'm referencing GroupWise as the running application, but it could apply to any system that needs to expand an XFS partition.
- This assumes it's not the OS partition. If you only have one giant partition, you'll likely need to use a live linux disk with partition tools to accomplish the task.
Step 1) Resize in VMWARE
The first step is to increase the disk size within vmware. Once this is done, the new size will be presented to the SLES OS. However, you cannot see or access the newly added space until the partitions are manipulated and increased.
Step 2) Adjust the partition tables with the "parted" tool.
** At this point you should have unmounted the partition you plan to resize **
You must first adjust the partition table and increase the size so that it fills the entire disk. Use the tool "parted" to accomplish this:
-
parted /dev/sdb resize 1 100%
The syntax is as follows:
- parted {device} {operation} {partition number} {size}
- device = disk you are expanding. In this case, /dev/sdb is the disk. Yours may be different.
- resize = this is the command that tells it to resize the partition.
- 1 = the partition number. If your entire disk is dedicated to the xfs partition, it's likely that the partition is 1. If you have multiple partitions, this could change.
- 100% = instructs it to resize to the full capacity of the disk.
NOTE: If you are unsure of which device/partition to use, you can use the "df -h" command. This will show you the partitions and the free space. But it also tells you the device and partition number:
-
/dev/sdb1 750G 468G 282G 63% /grpwise (This shows my device is /dev/sdb1, meaning device /dev/sdb and the 1st partition, or partition 1).
- You can also use the "parted" tool in interactive mode to select and view partitions. parted --> select /dev/sdb --> print
-
gw3:~ # parted GNU Parted 3.1 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:Number Start End Size Type File system Flags
1 1049kB 526MB 525MB primary xfs boot, type=83
2 526MB 4820MB 4294MB primary linux-swap(v1) type=82
3 4820MB 9113MB 4293MB primary xfs type=83
4 9113MB 80.5GB 71.4GB primary xfs type=83(parted) select /dev/sdb
Using /dev/sdb(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 805GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:Number Start End Size Type File system Flags
1 1049kB 805GB 805GB primary xfs type=83
-
Step 3) Grow the XFS partition into the expanded partition space.
You will then need to re-mount the xfs partition and then issue this command:
- xfs_growfs /grpwise
This will increase the xfs partition to match the size of the partition. You will need to change the mount point to reflect the configuration of your own system. /grpwise is the mount point I use in this example. Here is the expected output from the xfs_grow command:
server1:/ # xfs_growfs /groupwise/
meta-data=/dev/sdb1 isize=512 agcount=5, agsize=81872704 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0, rmapbt=0
= reflink=0 bigtime=0 inobtcount=0
data = bsize=4096 blocks=402652928, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=159907, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 402652928 to 536870656
What if this process DOESN'T work as outlined?
The worst part of any technical doc is when you are given instructions that are supposed to work, but they don't. Here are a couple things that could cause the above process to fail and/or not work. Theye may not be the exact answer, but hopefully this can point you in the right direction.
- It's possible that the SLES OS doesn't know about the new disk size. The easiest way to fix that is by rebooting the server. If you do this, you don't have to question whether it should recognize it or not. You may be able to use the partitioner to rescan the disks to update the size. That should do it but a reboot definitely will force it to get the change. You can also use this command to view what the OS recognizes:
- fdisk --list
This command will show you the partition tables for each disk. Look for your disk. It should report the size of the disk, followed by the sizes of any partition on the disk. If the size of the disk doesn't match what you have it set for in VMWare, that is where you need to focus your attention. A quick reboot should fix that aspect. If it already shows the full size, then it's likely the next bullet point.
- fdisk --list
- You need to unmount the partition before you can expand it. If you did not unmount the partition, that is very likely the reason why it's not working. If that is the case, just issue this unmount command:
- umount /dev/sdb
Of course, use the correct device name, and if there are any services running on that partition, make sure to shut them down first so that nothing is accessing the drive. Here is the sequence if you do need to unmount the partition first:- umount /dev/sdb
- parted /dev/sdb resize 1 100%
There may not be any feedback, it just returns to the command prompt. - mount /dev/sdb /grpwise
Use the correct path name on the partition mount point as well as the correct device name. Now the partition table itself has been expanded, you can grow the xfs partition into the full space with the next command. - xfs_growfs /grpwise
Use your own specific path where you have it mounted.
- umount /dev/sdb
That should get you through most hurdles. Hope that helps!