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.
There's a few steps here, but this only takes 2 minutes to complete! ;)

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:
  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
  2. Open the partition manager
    fdisk /dev/sda
    
  3. 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
  4. 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:)
  5. 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.
  6. Write our changes to the disk
    w
    
    A warning will probably say "Re-reading the partition table failed". Don't worry, it's OK. :)
  7. Tell the system that the partition table has changed
    partprobe /dev/sda
    
    ...or whatever device your system is installed on - see step 1
  8. Resize the filesystem to fill our new, larger partition
    resize2fs /dev/sda2
    
  9. 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
reboot
You can probably skip this, but 1 minute of rig downtime isn't going to hurt, is it?

Comments

Sign In or Register to comment.