Resize A Partition (Hetzner)

Hello,

So I think I made a mistake in my original install several months ago. When I run the command df -H, my home directory /dev/md3 is only allocated 4.9TB while /dev/md2 is allocated 1TB of which only 6.6GB of it is used.

I’d rather not have to completely reinstall and start from scratch if I don’t have to. The error must have been made when setting up the Software RAID in the Hetzner rescue system. Apparently I allocated 1TB to “/” root and only 6.6GB is being used.

I could really use that extra TB of space right now. How can I go about getting the majority of that space back for me to use with my main user account? Grateful for any assistance with this.

Thanks.

Filesystem      Size  Used Avail Use% Mounted on
udev            8.4G     0  8.4G   0% /dev
tmpfs           1.7G  169M  1.6G  11% /run
/dev/md2        1.1T  6.6G  1.1T   1% /
tmpfs           8.4G   25k  8.4G   1% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
tmpfs           8.4G     0  8.4G   0% /sys/fs/cgroup
/dev/md1        511M  200M  285M  42% /boot
/dev/md3        4.9T  4.4T  216G  96% /home
=

Shrinking and expanding partitions require that they be unmounted, so you’ll need to use recovery mode.

A quick google search has turned up some help :wink:

http://www.microhowto.info/howto/reduce_the_size_of_an_ext2_ext3_or_ext4_filesystem.html
http://www.microhowto.info/howto/increase_the_size_of_an_ext2_ext3_or_ext4_filesystem.html

These should leave the file system in tact during the operation, though this is still an inherently risky operation.

I know I’m late to the party but this might help someone searching or googling someday. What you are experiencing is not an issue with setting up software raid on Hertzner but rather further down in the config related to partitioning.

Liara pointed out how to do most of this but a break down for those who need it.

  1. Ideally back up your data before starting
  2. Reboot to recovery
  3. Mount home partition and root partition
  4. move the contents or your home partition to a home folder on ‘/’ (root of root partition)
  5. check your folder permissions so they match from the old location
  6. delete your home partition
  7. expand your root partition
  8. reboot and hope you did not b0rk your ish :wink:

Two things I’d suggest doing differently in the future

  1. Go with a proxmox virtual host, it’s easier dealing with things in this environment, upfront setup is time is more effort if you are not familiar but fixes are quicker/easier in the future.
  2. I’d skip partitioning in the future and go with LVM as it’s more flexible, allowing resizing and adding disks easily.

The following is my config w/ LVM for debian jessy (what proxmox is installed onto)

DRIVE1 /dev/sdb
DRIVE2 /dev/sda
SWRAID 0 ######I skipped raid for my usage
SWRAIDLEVEL 1 ###### irrelevant since I’m not using it
BOOTLOADER grub
HOSTNAME ######Put your FQDN here
PART swap swap 8G
PART /boot ext3 512M
PART lvm vg0 all ######[Skiping the root partition here opting for lvm & creating volume group 0]
LV vg0 root / ext4 all ######adding the root partition]
IMAGE /root/.oldroot/nfs/install/…/images/Debian-86-jessie-64-minimal.tar.gz

Hope this helps someone, I know I ran into the same issue, I never partition my disks with home and root being separate (I know it has it’s usefulness)