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:
[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?

8 Likes

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

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

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

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?

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

:uk: HiveOS tool disk-expand
You can resize a disk with HiveOS so that you can fill all available disk space using the disk-expand utility.
It’s easy to use tool just type command and you do’nt have time to blink an eye how everything will be done.


:ru: HiveOS утилита disk-expand
Изменить размер диска с HiveOS так чтобы заполнить все доступное дисковое пространство, теперь можно с помощью утилиты disk-expand
Это простой в использовании инструмент, просто введите команду, и вы даже глазом не моргнете как все уже будет готово.

5 Likes

Thanks a lot it work great

Hey guys, I’m running HiveOS on a SanDisk Cruzer Spark 30.8GB (32GB), and currently there’s like 650MB available. I’m not sure what would be taking up so much space on the drive. I tried the disk-expand option and it seemed to work, but didn’t change the available space. Suggestions? Just trying to get the thumb drive to a few gigs free. I have a thumbdrive on my other rig that is a SanDisk Cruzer Dial 31.4GB that shows 23GB available at any given time.

Scratch that. I just did firstrun -f and it repartitioned and is now showing 22GB free!

This is the easiest way. I can confirm it, still working in 2021.
In worker menu, just click button “run command” and type disk-expand , then click “run”

You can also run as disk-expand -s
-s mean silent mode without 5s waiting prompt before start repartitioning process (this way used by Hive itself on clean run)

3 Likes

Great, now I have 120 GB!!!

Yep!. Takes like 5 seconds to do it.

Thats what i thought, good find of the poster though :slight_smile:

It worked ! thank you so much !

Just corrupted my drive will have to start again.

Hello, how can I do if I just want to add some GB and not use the whole disk, since sometimes I use the same disk to save some personal files?