Resize filesystem to fill disk



G’day! Long time Linux user, first time miner.
I’m learning lots about mining, but I thought I could share some linux knowledge for people who haven’t used it before.

When you download the HiveOS disk image and write it to a USB drive, there will be free space on your USB drive which can’t be accessed by HiveOS.
If you put HiveOS on a 8GB USB there won’t be much free space, but if you put HiveOS on a 16GB - 64GB USB or even a 120GB SSD, there might be a lot of free space you want to use.
[spoiler]There’s a few steps here, but this only takes 2 minutes to complete! :wink: [/spoiler]

Here’s how you unlock the free space so you can use it.
Boot HiveOS and complete setup, use the terminal (or execute remotely via SSH or PuTTY) to complete the following steps as root:
[*] Find out where our root partition is

parted -l

The second line shows the what Disk the system is installed on, in my case /dev/sda
[*] Open the partition manager

fdisk /dev/sda

[*] Print a list of partitions on the disk


The partition we want to resize is the second one with Type Linux. For me, this was /dev/sda2
[*] Delete partition number 2


Now trust me on this one, you’re not going to delete HiveOS. Keep going with the steps. It’ll be OK! o:)
[*] Create a new partition number 2


press p for primary, then enter 3 times to accept the default values for the partition number, start and finish sectors.
[*] Write our changes to the disk


A warning will probably say “Re-reading the partition table failed”. Don’t worry, it’s OK. :slight_smile:
[*] Tell the system that the partition table has changed

partprobe /dev/sda

…or whatever device your system is installed on - see step 1
[*] Resize the filesystem to fill our new, larger partition

resize2fs /dev/sda2

[*] Check how much more free space you have now!

df -h


That’s it! You’ve resized the filesystem so you can access the whole disk.
Now you have more space for log files & other software.
I like to reboot the system just to make sure the new larger partition is detected by everything.

miner stop

You can probably skip this, but 1 minute of rig downtime isn’t going to hurt, is it?


G’day! :slight_smile:
Thanks! My free disk space now is 24G