Installation problems

Hi,

I am trying to install Freebsd on already installed SSD. Now the installation is somewhat ok, I can boot and login as user from ada0.

Now the serve has additional storage, which I am trying to use for general data/storage. I want to create a zfs pool.

Unfortunately, I can't do it.

I tried creating partition with gpart, but is says operation not permitted.

---
>> gpart create -s gpt ada1
returns
gpart : geom "ada1" : operation not permitted

--

>> dmesg | grep ada
returns
GEOM:: ada1 : the primary GPT table is corrupt
using the secondary table.. recovery strongly advised


So my question is how to partition the drives, and make it show in gpart show.

Thank you for your time.
 
So you want to destroy all files/partitions/scheme on ada1?

If yes, you must run before: gpart destroy -F ada1. Then, you can create a partition scheme: gpart create -s GPT ada1. After that, you can create partitions with gpart add -t type -s size ada1, where type and size depend on what you exactly want to do.

If you want a zfs partition that takes all the disk, just type: gpart add -t freebsd-zfs ada1.

See gpart(8).
 
Forgot to mention.. I tried that already..
gpart destroy -F ..

It returned gpart: arg0 'ada1'; Invalid argument
 
It's better to not forgot this kind of details...

Have you tried with /dev/ada1 as argument?
You can also try to repair the GPT scheme with gpart recover ada1 before to destroy it.
 
Agreed.

Yes, I have tried /dev/ada1 as argument, and gpart recover ..

Same error message: invalid argument
 
Also, I tried
dd if=/dev/zero ...

it said the same thing operation not permitted.

I also rebooted the machine, and tried the above commands: dd zero, gpart destroy, etc..

Same errors were replicated.
 
Did you boot from that disk? If that's the case the first sector might be locked from accidental overwrites.

sysctl kern.geom.debugflags=16
 
Let's assume that /dev/ada0 is your boot disk (which boots fine), and you're trying to add another disk as /dev/ada1.

If you don't care what's on /dev/ada1, you might want to format it first, using another computer, and then try plugging it in again. Once FreeBSD can 'see' /dev/ada1, refer to the FreeBSD handbook section about adding disks. Do pay attention to what it says early on about reading /var/dmesg.boot, your newly added drive might be 'seen' as something else.
 
Did you boot from that disk? If that's the case the first sector might be locked from accidental overwrites.

sysctl kern.geom.debugflags=16
Sir-

No I did not boot from that disk. I booted from another one.

In fact when I first logged in and tried gpart show:
ada0 had efi, boot, swap, zfs, free

Furthermore, it also showed ada1:
efi, swap, free, and zfs partitions.

These were possibly previous partitions from earlier installation.

I tried to create a pool, and then everything is went south after that. Can't show or create gpart.
:(
 
Assuming that gpart show confirms that your active root is on ada0, you can clean all the crap from the start of ada1 as follows:
Code:
sudo dd if=/dev/zero of=/dev/ada1 bs=1g count=2
If /dev/ada1 has ever been used in a gmirror(8), then you need to clean the gmirror metadata as well:
Code:
# Determine the "mediasize in bytes" for /dev/ada1
sudo diskinfo -v /dev/ada1
# Calculate the number of GiB on the drive.
# This is "mediasize in bytes"/(1024*1024*1024)
# Call it NNN.  Subtract 5 => NN5.
# Nuke the end of the drive (gmirror metadata).
sudo dd if=/dev/zero of=/dev/ada1 bs=1g seek=NN5 count=999999
 
Assuming that gpart show confirms that your active root is on ada0, you can clean all the crap from the start of ada1 as follows:
Code:
sudo dd if=/dev/zero of=/dev/ada1 bs=1g count=2
If /dev/ada1 has ever been used in a gmirror(8), then you need to clean the gmirror metadata as well:
Code:
# Determine the "mediasize in bytes" for /dev/ada1
sudo diskinfo -v /dev/ada1
# Calculate the number of GiB on the drive.
# This is "mediasize in bytes"/(1024*1024*1024)
# Call it NNN.  Subtract 5 => NN5.
# Nuke the end of the drive (gmirror metadata).
sudo dd if=/dev/zero of=/dev/ada1 bs=1g seek=NN5 count=999999
gpw928 Yes, it was part of mirror. How to clean the gmirror metadata?
And as I stated previously, I did trry dd if=/dev/zero of=/dev/ada1 bs=64000, without the seek and count. Am assuming that will cleanup the entire disk.
Anyway, it gave Invalid argument error.

I am trying gpart restore -F .. that seems to be working, and doing something.. ;-)
 
gpw928 thanks.

The gpart restore command is taking awfully long time-- Is it normal for a 1T disk? if not is it ok to kill the process?
 
gpart restore should take less than 1 second. It is written just a partition table which is very little data.
Try to kill it with first "kill" , second "kill -9".
 
The process I described above wipes the disk metadata completely.

There will be no partition table. Nor will there be a backup partition table, so trying to restore it is bound to fail.

The disk is ready to be initialised. Please see the handbook for how to proceed.
 
It can be interesting to know if there is still partition table data available.
What is the output of the following commands:
Code:
geom disk list | egrep "Name"

Code:
gpart backup ada1

Code:
fdisk -vsp ada1

Code:
gpart show -p
 

Attachments

  • Screen Shot 2021-06-23 at 4.24.04 PM.png
    Screen Shot 2021-06-23 at 4.24.04 PM.png
    83.5 KB · Views: 160
  • Screen Shot 2021-06-23 at 4.25.13 PM.png
    Screen Shot 2021-06-23 at 4.25.13 PM.png
    47.4 KB · Views: 112
Please don't post pictures of text. Just copy and paste it. The information that's shown doesn't add up with what you mentioned before:
I am trying to install Freebsd on already installed SSD. Now the installation is somewhat ok, I can boot and login as user from ada0.

Your system isn't installed on ada0. You have a mfi(4) based RAID card with 4 disks (mfisyspd0 to mfisyspd3), that's split up and used as two mirrored ZFS pools.
 
Back
Top