How to resize your encrypted HyperDrive Appliance data disk

Notes:
If your appliance uses an non-encrypted filesystem (this is a choice in the /va wizard at first setup), please follow the guide for unencrypted filesystem resizing.

Keep in mind that resizing an appliance is a risky procedure (high chance of human error), so we recommend to:
- Take a backup of your data disk
- Choose a size that is large enough, so you will not have to re-do this procedure regularly.

Procedure:

Resize disk with LUKS Encryption:

1. First resize disk in xenserver/vmware/..

2. Check the new difference
# fdisk -l

3. Stop all services which use /va

Note: If you use an older version of nmd | HyperDrive the PostgreSQL service name is: postgresql

# service httpd stop
# service stunnel stop
# service postgresql-9.4 stop

4. Unmount the data disk and close LUKS
# umount /va
# fsck -n /dev/mapper/secretfs
# cryptsetup luksClose secretfs

5. Partition

# parted -a optimal /dev/sdb --script print rm 1 mklabel gpt mkpart primary ext3 0% 100% print

6. Reopen LUKS partition
# cryptsetup luksOpen /dev/sdb1 secretfs
>> enter password

7. Get LUKS partition status
# cryptsetup status secretfs

Sample output:

/dev/mapper/secretfs is active.
type: LUKS1
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sdb1
offset: 2056 sectors
size: 156049348 sectors <--- IMPORTANT
mode: read/write

8. Resize LUKS container with new sectors
# cryptsetup resize /dev/mapper/secretfs -b 156049348

9. Check ext family file system and rezise
# e2fsck -f /dev/mapper/secretfs

Sample output:

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/secretfs: 2461/6553600 files (6.8% non-contiguous), 496579/26213376 blocks

# resize2fs /dev/mapper/secretfs <size> (passing no size will use full available blocks!)

10. Check file system
# fsck -n /dev/mapper/secretfs

11. Turn into ext3 again
# tune2fs -j /dev/mapper/secretfs

12. Remount everything
# mount -a

13. Start services

Note: If you use an older version of nmd | HyperDrive the PostgreSQL service name is: postgresql

# service stunnel start
# service postgresql-9.4 start
# service httpd start

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.