Try to create pool in cli

Hi Guys,

i have try to create a pool on cli because i want to follow this thread:

Migration path from 1 drive to 3 drives in Raidz1 (using only 2 new drives to the existing 1)

I’m not allowed to post the Link, sorry.

I can’t post the link, sorry.

For test, I try it with only one disk, because this is my test drive with no data.

My problem is, the system say the mountpoint is read-only and i don’t know what i make wrong.

Can anyone help me?

What i have do:

1. lsblk -o NAME,SIZE,MODEL
2. sudo parted /dev/sda mklabel gpt
3. sudo parted /dev/sda mkpart primary 1MiB 100%
4. lsblk -bo NAME,MODEL,ROTA,PTTYPE,TYPE,START,SIZE,PARTTYPENAME,PARTUUID
5. sudo sudo zpool create mypool /dev/disk/by-partuuid/639b9cb0-219a-4b20-90f8-4c7be83e3507

That is the error:

truenas_admin@nas[~]$ lsblk -bo NAME,MODEL,ROTA,PTTYPE,TYPE,START,SIZE,PARTTYPENAME,PARTUUID
NAME        MODEL                      ROTA PTTYPE TYPE   START           SIZE PARTTYPENAME             PARTUUID
loop1                                     0        loop              419213312                          
sda         ST16000NM001G-2KK103          1 gpt    disk         16000900661248                          
└─sda1                                    1 gpt    part    2048 16000898564096 Linux filesystem         639b9cb0-219a-4b20-90f8-4c7be83e3507
…
nvme0n1     GIGABYTE GP-GSM2NE3256GNTD    0 gpt    disk           256060514304                          
├─nvme0n1p1                               0 gpt    part    4096        1048576 BIOS boot                5df2c6e8-617e-49f2-819c-730357e0c3cd
├─nvme0n1p2                               0 gpt    part    6144      536870912 EFI System               aea33050-9882-484a-9f6d-31baa201fcbe
└─nvme0n1p3                               0 gpt    part 1054720   255520480768 Solaris /usr & Apple ZFS 28b87c09-ab65-4501-958d-0ec6b88a3375

truenas_admin@nas[~]$ sudo zpool create mypool /dev/disk/by-partuuid/639b9cb0-219a-4b20-90f8-4c7be83e3507cannot mount ‘/mypool’: failed to create mountpoint: Read-only file system

There are multiple problems in using Unix shell commands that modify pools or datasets, when normally done by the GUI. (Other things like moving files around can be done without issues.)

For off, you probably want to make a 2GB partition on your disk to avoid future headaches:

sudo parted /dev/sda mklabel gpt
sudo parted /dev/sda mkpart primary 1MiB 2GiB
sudo parted /dev/sda mkpart primary 0 100%

Now that is not exact syntax, because I rarely use Parted. But conceptually, it shows that you create a 2GB buffer partition. This accounts for replacement disks that might be a few hundred MegaBytes smaller than your existing disk(s).


Next, the default mount point location for zpool create is the root level. TrueNAS does not want you to do that, so, you use;

sudo zpool create -R /mnt mypool /dev/disk/by-partuuid/639b9cb0-219a-4b20-90f8-4c7be83e3507

Of course, you need to use the new part-UUID of the new partition table.

Thank you very much. That was the solution. If anyone have the same problem, there are my steps:

lsblk -o NAME,SIZE,MODEL
zpool status

sudo parted /dev/sda mklabel gpt
sudo parted /dev/sdf mklabel gpt

sudo parted /dev/sda mkpart primary 1MiB 100%
sudo parted /dev/sdf mkpart primary 1MiB 100%

lsblk -bo NAME,MODEL,ROTA,PTTYPE,TYPE,START,SIZE,PARTTYPENAME,PARTUUID

sudo zpool create -R /mnt HDD raidz1 /dev/disk/by-partuuid/2dbc82ed-4f67-4492-a4e4-d9782ab32062 /dev/disk/by-partuuid/1a3d9de7-3f42-427a-b7dc-d1f87749dc4c

sudo zpool export HDD

sudo systemctl restart middlewared

Is it necessary to create a 2 GB space?

No.

However, if you end up attempting to replace a failed disk with one that is just a tiny bit smaller, (even just 1 byte smaller), that will never work. The only solutions are either to backup the pool, and recreate it with the smaller disk. Or buy the next size up, (like 6TB if the original was 4TB).

In the old days FreeNAS, (and some TrueNAS releases), made a 2GB swap partition. Which if you run across that size problem, it was possible to manually fix it.

2 Likes