ZFS I do not understand gpart...

I'm new to FreeBSD. I have a server with a 2TB SSD, which is my boot drive. I have installed a second 2TB SSD which I'd like to use to mirror the first. The first drive is ada0 and the second is ada1.

sade can see the second drive, and correctly lists it as ada1, with a GPT partition scheme and otherwise empty. So I'm trying to follow the various guides about using gpart to correctly partition the drive and use it as a mirror, but I can't get past the first step:

Code:
> sudo gpart destroy -F ada1
gpart: ERROR: main: invalid number of parts 'destroy'
> sudo gpart create -s got ada1
gpart: ERROR: main: invalid number of parts 'create'
> sudo gpart backup ada0
gpart: ERROR: main: invalid number of parts 'backup'
 
Last edited by a moderator:
Sorry, but for my case I am completely confused and cannot reproduce what your setup in detail looks like, and what you're trying to do.
Since the thread is under the topic, and you said you wanna create a mirror, I presume you want to create a ZFS mirror pool by adding a second drive to the first one.
Maybe some basics about ZFS first:
With ZFS you neither mount partitions, nor drives, but pools, consisting of partitions.
Drive's partitions can be added to (or removed from) pools, which are created with at least one partition. The type of a pool (stripe [not recommended, except maybe for very special cases], mirror, or raid) is defined with its creation when the first partition(s) is added to it, and cannot changed later.
So, you can only "create" a mirror by adding a second drive's partition(s) to the first one's pool, if the first drive's partition is already part of a pool defined as a mirror.
If this ain't the case, you have to reconsider, maybe backup first, look for another solution suits your needs, or restart all over.

However, gpart:
If the second SSD is equal or larger as the first one, you can safe the first one's partition table to a file, and by that quickly, and easily create an exact copy of it on the second drive; see examples section in gpart's man page.
If that's what you want.
Simply adding partitions with gpart is part of The Handbook, as also part of gpart's man page examples, and quickly, and easily done (as long as the drive does not contain any ZFS partitions belonging to a pool. ZFS protects its partitions from being killed by mistake.)
Info:
You can add partitions of different sizes to a mirror, but of course the smallest one defines the size of the pool. And you cannot resize pools to have less storage, only keep the size, or grow them.

Maybe it's best to start to help you by you first give here a copy of what gpart show and
zpool status produces to look at your current partition setup.
 
Last edited:
Sorry, but for my case I am completely confused and cannot reproduce what your setup in detail looks like, and what you're trying to do.
Since the thread is under the topic, and you said you wanna create a mirror, I presume you want to create a ZFS mirror pool by adding a second drive to the first one.
Maybe some basics about ZFS first:
With ZFS you neither mount partitions, nor drives, but pools, consisting of partitions.
Drive's partitions can be added to (or removed from) pools, which are created with at least one partition. The type of a pool (stripe [not recommended, except maybe for very special cases], mirror, or raid) is defined with its creation when the first partition(s) is added to it, and cannot changed later.
So, you can only "create" a mirror by adding a second drive's partition(s) to the first one's pool, if the first drive's partition is already part of a pool defined as a mirror.
If this ain't the case, you have to reconsider, maybe backup first, look for another solution suits your needs, or restart all over.

Roger, I did not understand that. I'm treating this as a learning experience, and I documented every step of my server configuration, so I decided to start from scratch, create a mirror of my two drives, and then redo all of the subsequent configuration as documented. That took a few hours, but I'm now up and running with a mirrored pool.

Thanks!
 
Is your ada0 / ada1 mounted ? have to tried to execute gpart command as root and not sudo ?
what does gpart show tell you ?
Also lsblk for FreeBSD . Check this out , install it and see maybe you will se something you dont see on gpart or you missed something on gpart .
lsblk for FreeBSD is handy tool specially if you coming from Linux background and got used to this command and you need to to re-adjust with time towards FreeBSD options.
 
I'm treating this as a learning experience, and I documented every step of my server configuration, so I decided to start from scratch, create a mirror of my two drives, and then redo all of the subsequent configuration as documented.
Beginning (again) from scratch (and at the same time documenting) certainly has its merits, and probably also has some personal learning aspects to it as well: all bonafide positive points!

However, if you'd more or less take that as a rule of thumb and almost take that as a default action with FreeBSD (this is not Windows), I think you could easily sell FreeBSD—and its community—short, as well as yourself.

Learning to analyse what might have happened, what might have gone wrong, and perhaps more importantly: how to overcome the arisen problems and fix them is in my view in the long run a very viable learning path; with or without the solicited help of this forum. One aspect to this is to make an informative decision about the more appropriate action and weigh whether either trying to solve the problems in hand, or restart from scratch. I hope you'll tend to do the latter less and less.
 
I'm treating this as a learning experience, and I documented every step of my server configuration, so I decided to start from scratch, create a mirror of my two drives, and then redo all of the subsequent configuration as documented. That took a few hours, but I'm now up and running with a mirrored pool.
You are doing it right, pal! The learning experience will never end. 😁

If I keep on presuming, and may be allowed to give some additional ideas, I presume you set up two mirrored 2TB disks, each containing an EFI, boot, and / partition (while only the / is mirrored[!]) You decided for a 2TB mirror for your server for a reason: you wanna store data. My advice - the idea - was, (if not done already) to keep the system separated from your data.
Depending on what your server is going to do (software installed), the system does not need much space. My headless NAS uses ~6 GB, while my desktop machines use app. ~ 60..70 GB. So, 128, or 256 GB for the system was completely sufficient.
One way to do it could be to have large additional "data" partitions you create a mirrored "data" pool from, or (in my eyes even better, but details depend on your situation, and the job to be done) give the machine an additonal, small disk (~128...256 GB) that contains the system, only, and create one large 2 TB partition on each of the big SSD you create your data-pool from.

The core idea is to keep system and data always separated. The system is reinstalled quickly, so can be seen as "throw away", while your data needs to be stored safely, and be backupped. Having both separated makes not only maintenence and the backup process(es) easier, but it's also less effort if one day you move your data (pool) to another machine, enlarge it, or so.
Because you don't wanna restart all over again by scratch, everytime you reconfigure or upgrade your server. :cool:
 
Back
Top