Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Boot disk usage

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

Jerren

Member
Joined
Apr 15, 2020
Messages
74
Hey i'm new to freenas, after watching vids and reading stuff online, i did my first install and it went great. Here's the problem i ran into though. I used 2 120GB SSD's as boot drives and i was under the assumption that i would be able to use those SSD's for installs of plug ins or maybe even a small boot disk for a vm. Now when trying to install a plugin all i see is the data storage pool i made, not the 2 boot disk mirror.

Am i overlooking a function that needs to be turned on or is it just not possible to use those mirror'ed disks after you install freenas onto it?
 

Jerren

Member
Joined
Apr 15, 2020
Messages
74
Thanks for the reply! Trying it however i ran into a snag, at step 7 where you wipe the old install from the ssd's and do "gpart destroy ada4".
I get "gpart: Device busy", i've seen recommendations where people say to use the dd command to write the first and last part of the disks and i tried those but it didn't seem to work, every other step so far went fine.
 

Jerren

Member
Joined
Apr 15, 2020
Messages
74
So i have been trying and googling for awhile now and while i know it's an unsupported "how to" that got linked i'm still curious about some of the hickups i've been running into. But i got some questions that don't seem to give an answer googling around.

One of the problems i ran into was "operation not permitted" when trying to do "zpool labelclear ada0", which i found could be solved by using fdisk command (for example i used:"fdisk -1 /dev/ada0) and i saw the result they got was very different from mine. Now is it possible that HDD & SSD give different results on the fdisk command?

It was mainly annoying because they advised using " dd if=/dev/zero of=/dev/sdc bs=512 count=100 seek=976773068 ". So after looking up what it all ment, i tried doing "dd of=dev/ada0 bs=512" Because i know the disk id and from my fdisk result i knew sector size was 512. But the "if=" command i didn't think i needed so i left it out, i also tried to do the command with "count=100" but also got not permitted on that attempt and finally the seek part was left out because i could not see any sectors in the fdisk command. Hence why i asked if HDD will give a different result then an SSD.
 

Jerren

Member
Joined
Apr 15, 2020
Messages
74
Fdisk -1 /dev/ada0

******* Working on device /dev/ada0 *******
parameters extracted from in-core disklabel are:
cylinders=232594 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=232594 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
Sysid 238 (0xee),(EFI GPT)
start 1, size 4294967295 (2097151 Meg), flag 0
beg: cyl 0/ head 0/ sector 2;
end: cyl 257/ head 254/ sector 63
 

irTwit

Member
Joined
Aug 18, 2014
Messages
35
I was able to install FreeNAS-11.3-U2.1 for TrueNAS-12.0-U4 on an 8GB partition of my boot-SSD by modifying the install script. I have my jails on the boot-SSD and other fragmented temporary files. Though I only have one boot drive, I successfully used this method with a mirrored boot drive in a VM.

I saw methods (1,2) using USB drives and mirroring but didn't have a small USB drive and I thought my method below was more straight forward. This guide assumes an UEFI-boot, though it might also work for a BIOS-boot but I didn't test that. I have been running this configuration for a year without issues. I don't know what side effects this may cause, so use at your own risk.

Step 1: Install your future boot drive(s) and start-up the ISO install media. At the install menu enter the shell.

Step 2: Change directory to the install script location. Grant yourself write permission to the script and open it in a text editor. In this version of TrueNAS the code you want to change is inside the "create_partitions" function at line #511.
cd /etc
chmod 777 install.sh
vi +511 install.sh
Step 3: Replace the size variable with the size you want your TrueNAS boot partition to be. The example below uses "-s 8g". Save the changes and exit the text editor.
if gpart add -t freebsd-zfs -a 4k -i 2 -s 8g$(_size) $(_disk); then
Step 4: Execute the modified install script. During the install select one drive or more drives. Select multiple drives if you want a ZFS mirrored TrueNAS boot partition. If your drive is big enough the script will still ask if you want a swap drive or not.
./install.sh
Step 5: After the installer finishes, return to the shell. Optionally do this step in the TrueNAS GUI shell or SSH. Check if everything worked. There should be some free space on you boot drive(s) and a zpool. Note the devices and partition numbers in gpart. If you added a swap partition during the install your partition numbers will be one higher than the example code below.
gpart show
or
gpart show ada0
or
gpart show ada0 ada1

zpool status
Step 6: Create partitions with the remaining space. Specify the partition size (-s). Optionally you can align the partition or specify sector sizes with additional gpart arguments.
gpart add -t freebsd-zfs -s 16g ada0

or leave the size argument off to use the remaining free-space

gpart add -t freebsd-zfs ada0
Step 7: Create a pool with the new partition(s).
zpool create tank ada0p3

or mirrored if you used multiple boot drives

zpool create tank mirror ada0p3 ada1p3
Step 8: Export the new ZFS pool and reboot.
umount /tank
zpool export tank
Step 9: Import the new pool through the TrueNAS GUI.
 
Last edited:

Jerren

Member
Joined
Apr 15, 2020
Messages
74
Thanks for that, good to know there is another way to do it.

So that how to guide that got linked first, i finally got it to work. For some reason my usb stick got included in the original ssd mirror, no idea why. But that's what blocked alot of stuff and my inexperience with freenas probably didn't help either. In the end i pulled out the SSD's from the machine, connected them to another one, formatted both, reinstalled freenas on the usb stick and then i tried the how to guide again. Worked perfectly, all commands worked (did mess up with some typo's a couple of times but nothing with lasting effects), was able to import the config & import pools.

Thanks for linking the guide, i learned alot trying to figure this one out!
 

eysimir

Neophyte
Joined
Jun 9, 2021
Messages
7
Hi! Thanks for this excellent guide!

I'm a TrueNAS noob and I'm preparing my home / small office NAS for the first time. I followed irTwits guide above and managed to install a 32GB partition of TrueNAS on a 250 GB SSD. It works perfectly when installing TrueNAS without a swap partition, but unfortunately I run into an issue creating the pool of the remaining space, when installing with a swap partition (which is what I would like to do).

After creating the fourth partition (ada0p4), "gpart show" displays the following:
Code:
=>       40  488397088  ada0  GPT  (233G)
         40     532480     1  efi  (260M)
     532520   33554432     3  freebsd-swap  (16G)
   34086952   67108864     2  freebsd-zfs  (32G)
  101195816  387201312     4  freebsd-zfs  (185G)

This looks good to me, but when running the command in Step 7 "zpool create tank ada0p4" I get the following console message (time stamp removed):
Code:
... truenas.local savecore 1863 - - /dev/ada0p3: Operation not permitted

Note that the argument is correctly given as ada0p4, but the message says ada0p3!
Then, when running the command in Step 8 "zpool export tank" I get the following console message:
Code:
... truenas.local savecore 1864 - - /dev/ada0p3: Operation not permitted

Lastly, when doing the import from the TrueNAS GUI, there are four more console messages:
Code:
... truenas.local savecore 1908 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1929 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1947 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 2008 - - /dev/ada0p3: Operation not permitted


It seems to me that these operations should be executed on ada0p4 but somehow were pointed to ada0p3 instead. This would explain why the installation went fine when installing without the swap partition, where the manually created partition actually becomes ada0p3 and not ada0p4.

What can I do about this? Is there anyway to find out if these console messages are significant or not? Is there a way for me to fix this?

Any help is appreciated!
Thank you!
 

Jerren

Member
Joined
Apr 15, 2020
Messages
74
I'm no expert but step 7 has the command " zpool create tank ada0p3 " are you sure you adjusted it to zpool " create tank ada0p4 "? I mean typo's happen quickly especially when you aren't familiar with this stuff yet. I know i sure made alot of them.

Since there's no data on it yet ( i assume there isn't since the import failed) maybe you can just try again? Again i'm no expert but that's what i think happened. Also i don't know if people will read this since it's a different problem then what i had, it might be better to create your own topic and link to this one or copy over the guide you followed so it's clear to people that are trying to help.
 

eysimir

Neophyte
Joined
Jun 9, 2021
Messages
7
Thank you for your reply!

Yes - I'm 100% sure I wrote ada0p4 when installing with the swap partition, and ada0p3 when installing without the swap partition.
And I installed with the swap partition twice to be sure. Both installs gave me the exact same results.

Maybe I wasn't clear though. I haven't run into any problems other than the console messages. The import of the new pool worked fine and I can share and access the drive from the network. And you're right, there is no data yet, so I could reinstall again if I have to.

As you say, I will create a new topic if I don't get any further response here. Good point. Thanks!
 

irTwit

Member
Joined
Aug 18, 2014
Messages
35
eysimir, I went through my instructions just now with TrueNAS-12.0-U4 without any problems. I'm not sure what's causing the issue your experiencing.

 

eysimir

Neophyte
Joined
Jun 9, 2021
Messages
7
Thanks for your answer!
Except from the size of the boot partition (which I suppose is not the issue), the only difference in my install is that I did everything from Step 6 and forward in the TrueNAS GUI shell. Do you think this could have any significance?

Also, when doing a re-installation, there are a couple of additional install steps in the installation script, asking if I want a fresh install or not, and when creating the partition I also need to use the "-f" flag because it warns me the previous ada0p4 partition might be used. I don't know much about FreeBSD command line partitioning and formatting. Do you think I need to clean the disk further before re-installing? If so, how should I do that?

Thank you!
 

irTwit

Member
Joined
Aug 18, 2014
Messages
35
The partition sizes shouldn't matter. Also, I was able to successfully perform the guide's commands in the GUI shell.

As for reinstalling, you can destroy existing data on the drive by selecting Fresh Install and select the Format the Drive option to get rid of the previous install. In the shell you can also try deleting the partition and recreating it.

Code:
root@truenas[~]# gpart show
=>       40  125829040  ada0  GPT  (60G)
         40     532480     1  efi  (260M)
     532520   33554432     3  freebsd-swap  (16G)
   34086952   16777216     2  freebsd-zfs  (8.0G)
   50864168   74964912     4  freebsd-zfs  (36G)

root@truenas[~]# gpart delete -i 4 ada0
ada0p4 deleted

root@truenas[~]# gpart show
=>       40  125829040  ada0  GPT  (60G)
         40     532480     1  efi  (260M)
     532520   33554432     3  freebsd-swap  (16G)
   34086952   16777216     2  freebsd-zfs  (8.0G)
   50864168   74964912        - free -  (36G)
 

eysimir

Neophyte
Joined
Jun 9, 2021
Messages
7
I did a re-install again. This time I deleted partition 2, 3, & 4 before the installation, so this time I didn't get the question of a fresh install. I exited to the shell before reboot and did Step 6-8 from there. This way I didn't get the "Operation not permitted" during Step 7 & 8, but I still get it when importing the pool in the GUI after reboot:
Code:
... truenas.local savecore 1431 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1514 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1521 - - /dev/ada0p3: Operation not permitted


Sidenote: When creating the new pool I had to use the "-f" flag because of the old "potentially active" pool.
I also got this message:
Code:
cannot mount '/tank': failed to create mountpoint: Read-only file system

So, naturally "umount /tank" didn't work, but the pool was still created and exported without problem.
 

irTwit

Member
Joined
Aug 18, 2014
Messages
35
I did a re-install again. This time I deleted partition 2, 3, & 4 before the installation, so this time I didn't get the question of a fresh install. I exited to the shell before reboot and did Step 6-8 from there. This way I didn't get the "Operation not permitted" during Step 7 & 8, but I still get it when importing the pool in the GUI after reboot:
Code:
... truenas.local savecore 1431 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1514 - - /dev/ada0p3: Operation not permitted
... truenas.local savecore 1521 - - /dev/ada0p3: Operation not permitted


Sidenote: When creating the new pool I had to use the "-f" flag because of the old "potentially active" pool.
I also got this message:
Code:
cannot mount '/tank': failed to create mountpoint: Read-only file system

So, naturally "umount /tank" didn't work, but the pool was still created and exported without problem.
I just noticed that I get the same "Operation not permitted" messages when creating the pool the pool in the GUI shell but I don't get these messages on subsequent reboots. I'm still able to use the pool as expected though I don't know what side effects this may have. I haven't experienced any issues running this configuration on my personal server. Use at your own risk.
 

eysimir

Neophyte
Joined
Jun 9, 2021
Messages
7
Ah, ok. I suppose it's good that we get the same result, but unfortunate still that there is a problem.
I'll make a separate post with this issue to see if we can get any additional information about this.

Thanks for your input!
 
Top