Skip to content

Instantly share code, notes, and snippets.

@Platypuschan
Created December 13, 2022 17:29
Show Gist options
  • Save Platypuschan/0d301890954bd034b2d64e8ed844187e to your computer and use it in GitHub Desktop.
Save Platypuschan/0d301890954bd034b2d64e8ed844187e to your computer and use it in GitHub Desktop.
[TruenNasScale][Howto] split ssd during installation
We're going to adjust the installer script:
If you want to take a look at it beforehand it's in this repo under "/usr/sbin/truenas-install" https://github.com/truenas/truenas-installer
# to get working arrow keys and command recall type bash to start a bash console:
bash
# find the installer script, this should yield 3 hits
find / -name truenas-install
# /usr/sbin/truenas-install is the one we're after
# feel the pain as vi seems to be the only available editor
vi /usr/sbin/truenas-install
We are interested in the create_partition function, specifically in the call to create the boot-pool partition
line ~3xx: create_partitions()
...
# Create boot pool
if ! sgdisk -n3:0:0 -t3:BF01 /dev/${_disk}; then
return 1
fi
move the courser over the second 0 in -n3:0:0 and press x to delete. Then press 'i' to enter edit mode. Type in '+64GiB' or whatever size you want the boot pool to be. press esc, type ':wq' to save the changes:
# Create boot pool
if ! sgdisk -n3:0:+64GiB -t3:BF01 /dev/${_disk}; then
return 1
fi
You should be out of vi now with the install script updated. let's run it and install truenas scale:
/usr/sbin/truenas-install
The 'gui' installer should be started again. Select '[]install/upgrade' this time. When prompted to select the drive(s) to install truenas scale to select your desired ssd(s). They were sda and sdb in my case. Set a password or don't (I didn't because im not on a us-keyboard layout and hence my special characters in passwords are always the wrong ones when trying ot get in later). I also didn't select any swap. Wait for the install to finish and reboot.
6. Create the storage pool on the remaining space:
Once booted connect to the webinterface and set a password. Enable ssh or connect to the shell in System -> Setting. That shell keep double typing every key press so I went with ssh.
figure out which disks are in the boot-pool:
zpool status boot-pool
# and
fdisk -l
should tell you which disks they are. They'll have 3 or 4 partitions compared to disks in storage pools with only 2 partitions. In my case they were /dev/sda and /dev/sdb
next we create the partitions on the remaining space of the disks. The new partition is going to be nr 4 if you don't have a swap partition set up, or nr 5 if you have:
# no swap
sgdisk -n4:0:0 -t4:BF01 /dev/sda
sgdisk -n4:0:0 -t4:BF01 /dev/sdb
# swap
sgdisk -n5:0:0 -t5:BF01 /dev/sda
sgdisk -n5:0:0 -t5:BF01 /dev/sdb
update the linux kernel table with the new partitions
partprobe
and figure out their ids:
fdisk -lx /dev/sdX
fdisk -lx /dev/sdY
finally we create the new storage pool called ssd-storage (name it whatever you want):
zpool create -f ssd-storage mirror /dev/disk/by-partuuid/[uuid_from fdisk -lx disk1] /dev/disk/by-partuuid/[uuid_from fdisk -lx disk2]
export the newly created pool:
zpool export ssd-storage
and go back to the webinterface and import the new ssd-storage pool in the storage tab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment