Note: Linux file systems like ext2/ext3/ext4/xfs do not allow you to reduce the filesystem size without unmounting the disk. This means that you cannot decrease the size of the root device because you cannot unmount it.
Unmount the disk and reduce the size of the disk using your hypervisor tools. For example:
# umount /dev/mapper/clear_sdb1 # e2fsck -f /dev/mapper/clear_sdb1 # resize2fs /dev/mapper/clear_sdb1 <newsize>
Detach the disk using the command
hcl detach diskname, wheredisknameis the short form of the disk name (for example, you would usesdb1instead of/dev/sdb1).# hcl detach sdb1If this is a non-GPT data partition, decrease the underlying volume using the
fdiskcommand. For example:# fdisk /dev/sdb
If the data partition is a GPT partition, you need to delete the partition and recreate it with the new size. To do so:
Access the device using
gdisk.# gdisk /dev/sdbPrint all the information about the old partition using the
i partition-numbercommand and note the "Partition unique GUID".Important: You need to manually assign the current GUID to the resized partition or Cryptographic Security Platform Vault will not recognize the resized partition.
Command (? for help): i 1 Using 1 Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data) Partition unique GUID: 1390EA67-17AB-48F9-9851-8C8D54A9E454 First sector: 2048 (at 1024.0 KiB) Last sector: 585727 (at 286.0 MiB) Partition size: 583680 sectors (285.0 MiB) Attribute flags: 0000000000000000 Partition name: '1'Delete the old partition.
Command (? for help): d 1Re-create the new partition with same start but different size when prompted.
Command (? for help): n 1Switch to expert mode.
Command (? for help): xSet the saved GUID for the partition.
Expert command (? for help): c 1 Using 1 Enter the partition's new unique GUID ('R' to randomize): 1390EA67-17AB-48F9-9851-8C8D54A9E454Save the changes to disk.
Expert command (? for help): w
Re-read the partition table using the
partprobecommand. For example:# partprobe /dev/sdb
Note:
partprobemay fail if the underlying device is busy, which can happen if LVM is configured for another partition on the same disk. If it fails, reboot the VM and continue with this procedure. The partition table will be correctly updated during the reboot.Reattach the disk using the command
hcl attach diskname, wheredisknameis the short form of the disk name.# hcl attach sdb1