Resize filesystem to fill disk

setup
install
filesystem
resize

#1

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:
[list=1]
[*] 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

p

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

d

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

n

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

w

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

[/list]

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
reboot

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


#2

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


#3

Thank you!! 1GB to 51GB :rocket:


#4

Hi, I got this partition info below. Already tried the disk-expand but failed. What should I do? Thanks.

Number Start End Size Type File system Flags
1 1049kB 22.0MB 21.0MB primary fat16 lba
2 22.0MB 7521MB 7499MB primary ext4
3 7521MB 31.4GB 23.9GB primary fat32 boot, lba


#5

One of my rigs doesn’t have linux partition:

1 1049kB 22.0MB 21.0MB primary fat15 lba
2 22.MB 7521MB 7499MB primary ext4 boot

Should I delete partition 2?


#6

Nevermind, for some reason it didn’t get into the partition tool correctly at step “fdisk /dev/sda”. works now :slight_smile: