Solved Confused with gpart

Hi,

I try to migrate a system from Linux to FreeBSD, but I have some disk issue.

I have a computer with 4 disk:
- 2 internal disk are working fine. (both MBR) (ada0 and ada2) (both created with Linux)
- 1 usb external disk (MBR OR GPT) is not seen by gpart (da0 ?) (also created with Linux)
- 1 internal zfs on whole disk is working but not seen by gpart (ada1 ?) (recently created by my FreeBSD computer)

When I did gpart status I got:

Code:
$ gpart status
                  Name   Status  Components
                ada0s1       OK  ada0
                ada0s2       OK  ada0
                ada0s3       OK  ada0
               ada0s3a       OK  ada0s3
               ada0s3b       OK  ada0s3
                ada1p1  CORRUPT  ada1
                ada1p2  CORRUPT  ada1
                ada2s1       OK  ada2
                ada2s2       OK  ada2
                ada2s3       OK  ada2
                ada2s4       OK  ada2
diskid/DISK-9VS0GZ7Jp1  CORRUPT  diskid/DISK-9VS0GZ7J
diskid/DISK-9VS0GZ7Jp2  CORRUPT  diskid/DISK-9VS0GZ7J


I then did zfs mount -a
And now

Code:
$ gpart status
   Name  Status  Components
 ada0s1      OK  ada0
 ada0s2      OK  ada0
 ada0s3      OK  ada0
ada0s3a      OK  ada0s3
ada0s3b      OK  ada0s3
 ada2s1      OK  ada2
 ada2s2      OK  ada2
 ada2s3      OK  ada2
 ada2s4      OK  ada2

And I got the same result even if I zfs umount -a

I dont know if it will be helpful but:

Code:
$ ls /dev/ada*
/dev/ada0   /dev/ada0s2   /dev/ada0s3a   /dev/ada1   /dev/ada2s1   /dev/ada2s3
/dev/ada0s1   /dev/ada0s3   /dev/ada0s3b   /dev/ada2   /dev/ada2s2   /dev/ada2s4
$ gpart status ada1
gpart: No such geom: ada1.

But I can see my zfs data ... and my disk seems to correctly work.

So what is going on ?

And about my external disk

Code:
$ gpart status da0
gpart: No such geom: da0.
$ ls /dev/da0*
/dev/da0

Why gpart cannot see it ?

thanks
 
try:
Code:
gpart show ada0 # first disk
gpart show ada1 # second disk
gpart show ada2 # third disk
gpart show da0  # first removable disk
 
try:
Code:
gpart show ada0 # first disk
gpart show ada1 # second disk
gpart show ada2 # third disk
gpart show da0  # first removable disk

Here is the result:
Code:
$ gpart show ada0
=>       63  250067504  ada0  MBR  (119G)
         63       1985        - free -  (993K)
       2048   41943040     1  linux-data  (20G)
   41945088  146683904     2  linux-data  (70G)
  188628992   60817408     3  freebsd  [active]  (29G)
  249446400     621167        - free -  (303M)

$ gpart show ada1
gpart: No such geom: ada1.
$ gpart show ada2
=>        63  1953522992  ada2  MBR  (932G)
          63        1985        - free -  (993K)
        2048   110319616     1  ntfs  (53G)
   110321664   411645952     2  fat16  (196G)
   521967616    29296640     3  linux-data  [active]  (14G)
   551264256  1402257408     4  linux-data  (669G)
  1953521664        1391        - free -  (696K)

$ gpart show da0
gpart: No such geom: da0.


When ZFS uses a whole disk there won't be a partition table. So gpart(8) will just error as there's nothing for it to read.

Thanks, that make sense and that explain why I cannot see ada1 (whole disk used for zfs)
But I still have the issue with my usb external disk da0.
 
I m using last version of FreeBSD 11.0

I think it's da0 because when I started my computer I didnt have /dev/da0.
I could see it only after plugin it into my computer

Code:
root@FreeBX:~ # usbconfig
ugen0.1: <UHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen1.1: <UHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen2.1: <UHCI root HUB Intel> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen3.1: <EHCI root HUB Intel> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen4.1: <UHCI root HUB Intel> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen5.1: <UHCI root HUB Intel> at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen6.1: <UHCI root HUB Intel> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)
ugen7.1: <EHCI root HUB Intel> at usbus7, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen3.2: <USB2.0 Hub VIA Labs, Inc.> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.2: <G15 Keyboard Hub vendor 0x046d> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (100mA)
ugen1.3: <G15 Gaming Keyboard vendor 0x046d> at usbus1, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen2.2: <USB Optical Mouse Logitech> at usbus2, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen1.4: <G15 GamePanel LCD vendor 0x046d> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen3.3: <Expansion Desk Seagate> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)
root@FreeBX:~ # sysctl kern.geom.disk
kern.geom.disk.da0.led:
kern.geom.disk.ada2.led:
kern.geom.disk.ada1.led:
kern.geom.disk.ada0.led:
root@FreeBX:~ # uname -a
FreeBSD FreeBX 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

And also dmesg|grep da0 returned me
Code:
Trying to mount root from ufs:/dev/ada0s3a [rw]...
da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
da0: <Seagate Expansion Desk 0319> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number NA4LJD2W
da0: 40.000MB/s transfers
da0: 3815447MB (976754645 4096 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
GEOM: da0: corrupt or invalid GPT detected.
GEOM: da0: GPT rejected -- may not be recoverable.
GEOM: da0: corrupt or invalid GPT detected.
GEOM: da0: GPT rejected -- may not be recoverable.
 
Yes, I tried from root account and I have the same result.
I will try to check it again from linux to check if the disk didn't died (it was working yesterday on Linux ...).
 
Well, my disk seems to work on Linux ...

I dont understand what is the problem.
I would like to put zfs on the whole disk and use it as a backup disk, but I dont know if I can trust this disk on FreeBSD
 
GEOM: da0: corrupt or invalid GPT detected.
GEOM: da0: GPT rejected -- may not be recoverable.
GEOM: da0: corrupt or invalid GPT detected.
GEOM: da0: GPT rejected -- may not be recoverable.

Well, my disk seems to work on Linux ...

I dont understand what is the problem.
How Linux sees this disk ? GPT partitioned ?

Anyway, the corrupted GPT for itself would be a software error, not an hardware disk fault.
 
There are few reasons why the disk is not working on FreeBSD.

- The disk is recognized with wrong sector size. The dmesg(8) message says 4096 byte sectors, does Linux agree with that?

- The disk is recognized with wrong geometry, if the sector sizes agree on both OSes compare the number of LBA sectors reported.
 
  • Thanks
Reactions: ASX
The disk has a gpt partition table

Here is how my linux see this disk.
As you can see, everything match (same size, LBA, sectors size)

Code:
navaros@rox:~$ dmesg |grep sdd
[    5.420424] sd 8:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)
[    5.421179] sd 8:0:0:0: [sdd] Write Protect is off
[    5.421183] sd 8:0:0:0: [sdd] Mode Sense: 2b 00 10 08
[    5.421925] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA
[    5.422668] sd 8:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)
[   10.922202]  sdd: sdd1 sdd2 sdd3
[   10.923301] sd 8:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)
[   10.924795] sd 8:0:0:0: [sdd] Attached SCSI disk
[   16.882674] EXT4-fs (sdd2): mounted filesystem with ordered data mode. Opts: (null)
[   17.260528] EXT4-fs (sdd3): mounted filesystem with ordered data mode. Opts: (null)


gparted say that
Code:
Partition table gpt
Heads 255
Sectors/track 63
Cylinders 60800
Total sectors 976754646
Sector size 4096
 
That's the reason why FreeBSD thinks the GPT partition table is corrupt, it looks for the backup table at the wrong sector. The device probably needs an usb_quirk(4). Something like this:

Code:
usbconfig -d ugen3.3 add_quirk UQ_MSC_READ_CAP_OFFBY1

I think you need to detach and re-attach the device for the setting to apply. This will of course only last until the next reboot, refer to the example at the end of the usb_quirk(4) manual page on how to make it permanent.
 
Actually the number of sector differ of 1 unit.

whoww .. you have good eyes.
Thank you.

That's the reason why FreeBSD thinks the GPT partition table is corrupt, it looks for the backup table at the wrong sector. The device probably needs an usb_quirk(4). Something like this:
Code:
usbconfig -d ugen3.3 add_quirk UQ_MSC_READ_CAP_OFFBY1

Thank you.
I won't do it since I don't mind about the data on this disk. I will just put zfs on the whole disk.
I only wanted to know if I could trust my disk and if I can use it on FreeBSD.
thank you anyway
 
ouch .... too late :(
I didn"t think about that.
So I will have to be very careful not to plug my disk in a Linux computer !
 
Back
Top