Solved How to create RAID1 for a entire disk with UFS and GPT?

Thank you. However, it is that setting up mirrored partitions. Seem to be unable to create whole disks mirror for GPT.
 
You could even consider combining gmirror(8) with gjournal(8) if you want a bit of extra reliability. It's my experience so far that the software journal updates are often less reliable than those of gmirror.

(edit)

Thank you. However, it is that setting up mirrored partitions. Seem to be unable to create whole disks mirror for GPT.
Sure it can. Just make one single UFS filesystem and mirror that.

(edit2)

Keep in mind that this is software RAID and therefor you're relying on the OS to perform this for you. As such you're limited to a per-filesystem RAID setup only. If you want more you'll need hardware raid.

I stand corrected on this one, see SirDice message below mine ;)
 
I seem to remember gmirror and GPT don't like working together as they both want to use the end of the disk. I recall using it a few years ago and ended up mirroring 3 partitions instead. It worked fine although I suspect it would cause some disk thrashing during a replacement if they're set to rebuild automatically and all partitions try to rebuild at the same time.

The examples in the handbook above appear to recommend MBR for full disk mirroring.
 
I seem to remember gmirror and GPT don't like working together as they both want to use the end of the disk. I recall using it a few years ago and ended up mirroring 3 partitions instead. It worked fine although I suspect it would cause some disk thrashing during a replacement if they're set to rebuild automatically and all partitions try to rebuild at the same time.

The examples in the handbook above appear to recommend MBR for full disk mirroring.

Yes, I mean this. If the mirror partition, where will it store the metadata? Still at the end of the hard drive? Or at the end of the partition?
 
Yes, I mean this. If the mirror partition, where will it store the metadata? Still at the end of the hard drive? Or at the end of the partition?
End of the partition, see also gmirror(8):
Code:
     The gmirror utility uses on-disk metadata (stored in the provider's last
     sector) to store all needed information.  Since the last sector is used
     for this purpose, it is possible to place a root file system on a mirror.
Where 'provider' is the device used for the mirror.
 
  • Thanks
Reactions: sdf
If mirroring a partition, the partition will be treated as a provider, it's right?
 
Ayups. I glossed over that too fast as well (as seen in my first message in the thread ;) ).

The provider(s) are the devices which make up the actual mirror.
 
A "GEOM provider" is a GEOM device that you can use; i.e format, put data on, etc.

Your full disk is a GEOM provider, exposed as /dev/adaX
If you partition a disk, each partition is a GEOM provider, exposed as /etc/adaXp1

When you create a mirror, it requires 2 GEOM providers, and exposes the mirror as a new GEOM provider - /dev/mirror/xyz.

Due to this design, it's possible to stack GEOM classes. For example you could create two encrypted partitions, which will show up as device.eli providers, and use them in a mirror, or the other way around (which makes far more sense in this example as you'd only be encrypting data once).

As mentioned gmirror puts metadata at the end of the provider. This causes problems if you use /dev/adaX, as that exposes the entire disk, including the blocks at the very end (and the start) where gpart would usually put its backup GPT table.

If you partition the device, then each partition's GEOM device only points to the partition, and GPT obviously makes sure that the partitions don't include the parts of the disk where it stores its config.
 
So now the big question: are you actually trying to set up something mirrored (or journaled) or not? Because the steps you're following now would indicate that you're not, which seems odd considering the topic of this thread.

(edit) So you start a thread to ask about mirroring an entire disk only to end up setting up a mirror for each individual partition without telling about that. That's not helping.

Anyway, if that's the sequence in which you executed the commands then it seems normal for it to fail, because it looks as if you tried to bootstrap first and setup the partitions second. That's obviously not going to work.
 
Even if don't gmirror gm0, the result is the same.
That doesn't tell me anything.

And I think I found the cause: gpart backup ada0 | gpart restore ada1.

Why on earth do that? That makes no sense at all, just set up a partition scheme for all your disks individually.

(edit): Just because you copied the partition table doesn't automagically make those partitions physically appear. It takes more than just a table. As such the errors and problems above.

I have no idea where you got these ideas from, but if you're following some kind of guide then I strongly suggest you stop following it because this looks pretty bad to me.

(edit2) Next time consider using: # gmirror label -v gm0 ada0p1 ada1p1, saves you time & effort.
 
No, It has no problem at all.
That's not what you told us earlier:

I set up it
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1
, but get
Code:
gptboot: Invalid primary GPT header
gptboot: Invalid backup GPT header
gptboot: unable to load GPT
Notice ada1?

Anyway, people changing their story and problems in between a thread is where I draw the line. I got better ways to spend my time.

Good luck.
 
Back
Top