5 min read

Access Your Hard Drives While Mining on HiveOS using SAMBA

Originally posted 2021-12-05
Access Your Hard Drives While Mining on HiveOS using SAMBA

Introduction

HiveOS is a mining operating system that allows users to simply boot a Linux distribution that is custom designed for Cryptocurrency Mining. Everything you need is included and it all fits and boots from a USB stick.

Everything as in, every driver for every card and automatic updates. You can also overclock your GFX cards giving your rig an extra boost of mhz.

What's not included is a network file access system so that i can still access my hard drives that still live in the rig because small miners like me with just a couple of cards to mine still want access to files for things like farming Chia.

It is important to note that you must understand the security risks before doing this. If your computer is connected directly to the internet without a router/firewall or is public facing you really shouldn't be doing this. If you have a really big rig you shouldn't be doing this either but small miners like me may find some benefits of SAMBA file access.


🚀 Bonus Overclock Settings for RX580 - Samsung Memory

Flash your bios with the straps below. Overclocking on HiveOS requires you to remove all DPM states just leave them blank if you want to do an extreme undervolt.

Samsung Straps - RX 580 8GB
000000000000000022CC1C00EF695D48E03110172ECB95090060060024001520FA8900A0030000000F10303A99262F16
FAN%Core ClockCore StateCore VoltageMemory ClockOutput
70%1175Mhz1850mV2150Mhz31.83Mhz

AMD RX 580 Stable Overclocks


Below is our hard drives listed in HiveOS

HiveOS Dashboard

Logging into HiveOS SSH

if you already know how to connect to HiveOS over SSH, skip to SAMBA Installation

We need to connect to our HiveOS via SSH to make it easier to enter the commands. To do this we go to our HiveOS web interface and click the icon in the image below then click Hive Shell Start

Start shell in HiveOS
HiveOS Start Shell

This sends the command to open an SSH session and you will see the wait ticker like below

Hive Shell Startwait
Hive shell wait

When the command has completed, click on the "Hive Shell" to open the SSH settings

Shell started HiveOS
Shell Started - HiveOS

Use this information and copy it into any terminal, if your using Windows 10/11 use Ubuntu WSL2.

WSL2 ssh access to hiveos
HiveOS Ubuntu WSL SSH Connect

You will be presented with the below. This is where we will be entering our commands

SAMBA Installation

We will be installing and setting up SAMBA. Specifically samba for Ubuntu since thats what HiveOS is based on. I'm not going to waste any more time. Follow the commands below one by one and you will have a fully functioning file server which allows you to view and edit the files on the hard drives in the system. I will be explaining how to do just one hard drive, if you have more just repeat the process.

Let's update our packages first, sudo is not needed because we are root

apt update

Then we can install samba with

apt install samba

You can check the status of SAMBA with

systemctl status smbd

If you are using UFW, allow samba by typing

ufw allow 'Samba'

Backup our smb.conf file IMPORTANT ‼️

cp /etc/samba/smb.conf{,.backup}

Now we can proceed to edit our smb.conf settings. Instead of copy pasting just delete the old file and create a new one

rm /etc/samba/smb.conf

Create a new smb.conf

nano /etc/samba/smb.conf

Enter the following to set up a samba share

[global]
netbios name = HiveShare
server string = Hive Share
workgroup = WORKGROUP

[HIVEOS]
path = /media/dazeb/1tbssd
comment = No comment
writeable=Yes
create mask=0777
directory mask=0777
public=no

Lets start by adding a user and setting its password

useradd dazeb
passwd dazeb

Now we have a user we can add the user to the smbpasswd file

smbpasswd -a dazeb

Enter the password to be used with your samba login.

Now restart the samba service.

service smbd restart
service nmbd restart

Setting up Hard Drives & Mount Points

Type the command below to see which drive you want

lsblk

In my case i get the below

lsblk output

Our targeted drive is marked in red, specifically sdb1. This is my 1tb SSD i use as a network drive for the whole house, just for transferring small files and holding my 3D printing models. I have another SSD but the rest are just HDD's that have Chia plots on them.

First let's create a folder where our hard drives will be mounted, mine will be /media/dazeb/

Here we will

  • make the directory for shared drives /media/dazeb
  • cd into the directory
  • make the directory to be mounted mkdir 1tbssd
  • change the permissions on the directory recursively
mkdir /media/dazeb
cd /media/dazeb
mkdir 1tbssd
chown -R dazeb:dazeb /media/dazeb

Earlier we set our samba details in smb.conf. Wherever you create the folder will need to be updated in the smb.conf file as seen below.

Mounting the Drive

We can mount our hard drive to the new folder with the following command. Your settings may be different based on the username used

mount /dev/sda1 /media/dazeb/1tbssd

Restart samba

service smbd restart
service nmbd restart

==Other Useful Commands==
sudo service smbd status
sudo service smbd start
sudo service smbd stop
sudo service smbd restart

Doing lsblk again gives us.

Persistence After Reboots 💾

Now the hard drive is mounted, we can make sure that the drives get automatically mounted each time the computer boots.

To do this we have to edit the /etc/fstab file.

First backup the fstab file

cp /etc/fstab{,.backup}

Then edit it with nano

nano /etc/fstab

Add the drive using its UUID we can find the UUID by typing

blkid

Here is the disk we are looking for and its UUID

Now we have the UUID we can add it to the /etc/fstab file

nano /etc/fstab

Add the hard drive and mount location

UUID=14D82C19D82BF81E /media/dazeb/1tbssd    auto nosuid,nodev,nofail 0 0

Example

Now Reboot and your drives should be automatically mounted 🎉 if you have no monitor attached to the rig give it an extra couple of minutes to fully boot, don't panic.

Accessing from a Windows PC

Ok, to access the computer from a Windows 10/11 PC simply open the file manager by clicking the file icon then typing into the address bar the IP for the computer that is using HiveOS along with \\ before it

Example \\192.168.0.10

Accessing SAMBA from Windows 10

Complete!

And there we have it. If you need to access different drives repeat the process for each drive.