Re: zpool can not create a pool after using gdisk to prepare the device

From: Johan Hendriks <joh.hendriks_at_gmail.com>
Date: Tue, 12 Jan 2021 10:45:46 +0100
On 12/01/2021 07:50, Graham Perrin wrote:
> I used gdisk(8) with a USB flash drive to:
>
> 1. zap (destroy) GPT data structures
> 2. blank out the MBR
> 3. (below) write a new GPT with a FreeBSD ZFS (A504) partition at 
> /dev/da1p1
>
> ----
>
> root_at_mowa219-gjp4-8570p:~ # gdisk /dev/da1
> GPT fdisk (gdisk) version 1.0.5
>
> Partition table scan:
>   MBR: not present
>   BSD: not present
>   APM: not present
>   GPT: not present
>
> Creating new GPT entries in memory.
>
> Command (? for help): n
> Partition number (1-128, default 1):
> First sector (34-7827358, default = 2048) or {+-}size{KMGTP}:
> Last sector (2048-7827358, default = 7827358) or {+-}size{KMGTP}:
> Current type is A503 (FreeBSD UFS)
> Hex code or GUID (L to show codes, Enter = A503): A504
> Changed type of partition to 'FreeBSD ZFS'
>
> Command (? for help): w
>
> Final checks complete. About to write GPT data. THIS WILL OVERWRITE 
> EXISTING
> PARTITIONS!!
>
> Do you want to proceed? (Y/N): y
> OK; writing new GUID partition table (GPT) to /dev/da1.
> Warning: The kernel may continue to use old or deleted partitions.
> You should reboot or remove the drive.
> The operation has completed successfully.
> root_at_mowa219-gjp4-8570p:~ #
>
> ----
>
> I exported the pool that used the device at /dev/da0 (preparing for a 
> disruptive test), removed both devices then reconnected the USB flash 
> drive.
>
> zpool can not create a pool, the file system is reportedly read-only. 
> Please, why is this?
>
> ----
>
> root_at_mowa219-gjp4-8570p:~ # tail -n 0 -f /var/log/messages
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: ugen0.6: <Kingston 
> DataTraveler G2> at usbus0 (disconnected)
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: umass0: at uhub1, port 3, 
> addr 14 (disconnected)
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: da0 at umass-sim0 bus 0 
> scbus6 target 0 lun 0
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: da0: <Kingston DataTraveler 
> G2 1.00>  s/n 001D0F0CAABFF97115A00A15 detached
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: (da0:umass-sim0:0:0:0): 
> Periph destroyed
> Jan 12 06:44:44 mowa219-gjp4-8570p kernel: umass0: detached
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: ugen0.6: <Kingston 
> DataTraveler G2> at usbus0
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: umass0 on uhub1
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: umass0: <Kingston 
> DataTraveler G2, class 0/0, rev 2.00/1.00, addr 15> on usbus0
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: umass0:  SCSI over 
> Bulk-Only; quirks = 0xc100
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: umass0:6:0: Attached to scbus6
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0 at umass-sim0 bus 0 
> scbus6 target 0 lun 0
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0: <Kingston DataTraveler 
> G2 1.00> Removable Direct Access SCSI-2 device
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0: Serial Number 
> 001D0F0CAABFF97115A00A15
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0: 40.000MB/s transfers
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0: 3821MB (7827392 512 
> byte sectors)
> Jan 12 06:44:48 mowa219-gjp4-8570p kernel: da0: quirks=0x2<NO_6_BYTE>
> ^C
> root_at_mowa219-gjp4-8570p:~ # lsblk da0
> DEVICE         MAJ:MIN SIZE TYPE LABEL MOUNT
> da0              1:247 3.7G GPT - -
>   <FREE>         -:-   1.0M -                                     - -
>   da0p1          1:248 3.7G freebsd-zfs gpt/efiboot0 <ZFS>
> root_at_mowa219-gjp4-8570p:~ # zpool create -m /media/sorry sorry /dev/da0p1
> cannot open '/dev/da0p1': Read-only file system
> root_at_mowa219-gjp4-8570p:~ #
>
>
It looks like it is mounted or something like that.
So see with mount if it is mounted somewhere.

I alway use gpart to partition disk and i never have problems.
gpart destroy -F /dev/da0
gpart create -s GPT /dev/da0
gpart create -a 1M -t freebsd-zfs -l LABELNAME /dev/da0

Now you can create your pool using zpool create sorry gpt/LABELNAME

This way you create your pool using the GPT labelname that never 
changes, and you can use it everywhere
Received on Tue Jan 12 2021 - 08:45:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:26 UTC