USB Drive unavailable

Hi,

I must have made a stupid decision when I connected my external SSD to my Truenas Scale via USB adapter and connected it to my pool. This morning I noticed that the system rebooted overnight and my pool is no longer loaded.

When I enter “zpool import” in the console, I get the following output

root@truenas[~]# zpool import

pool: vmpool
id: 12009859409450436085
state: UNAVAIL
status: One or more devices contains corrupted data.
action: The pool cannot be imported due to damaged devices or data.
config:
vmpool UNAVAIL insufficient replicas
nvme0n1p4 ONLINE
694dfb9c-f13f-4bed-b69b-76e810e2b9c3 UNAVAIL

Is there still a possibility to save the pool or do I have to delete the pool and all data is gone?

This was a pool comprised of a single disk (external NVMe via USB enclosure)?

Are you implying the NVMe used to be install internally prior to using a USB adapter?

I got a internal nvme with truenas on the 1 Partition and a Pool on the second and for Testing i expand the Pool with a ssd over a usb to sata cable.

I’m having trouble understanding.

You have a boot device (internal NVMe), that you manually partitioned to also create a user/storage pool?

Then you… plugged in an external drive, via a USB adapter, to… expand the existing pool that lives on a partition on your boot device?

What you did here was not sensible - whilst we need to focus here on how to get your pool back, next time ask for some advice before you decide to use an unusual pool layout.

To get this pool back online we need to establish what has happened to the USB drive. Can you please run the following:

  • lsblk -bo NAME,PTTYPE,TYPE,START,SIZE,PARTTYPENAME

Try to identify the USB device, and if you can then run:

  • sudo sgdisk -p /dev/xxx

where xxx is the device name for the USB device.

Then post the output for each of these here (and try to preserve the formatting using the editors “preformatted text” button).

If we can get the data back, you need to decide how to switch to a more sensible pool design, and if not you will need to recreate it and that would be best done on a more sensible pool design.

So lesson learned. Thank you for clear message. basicly i know that it was not the best idea but what should i say? :confused:

I run the command with the the USB Drive in same Port as i installed it.


root@truenas[~]# lsblk -bo NAME,PTTYPE,TYPE,START,SIZE,PARTTYPENAME
NAME        PTTYPE TYPE    START         SIZE PARTTYPENAME
nvme0n1     gpt    disk          240057409536 
├─nvme0n1p1 gpt    part     4096      1048576 BIOS boot
├─nvme0n1p2 gpt    part     6144    536870912 EFI System
├─nvme0n1p3 gpt    part  1054720  17179869184 Solaris /usr & Apple ZFS
└─nvme0n1p4 gpt    part 34609152 222336909312 Linux filesystem

In the first try i did not find the USB drive and i dont change the slot. After that i switch the USB Port and run the Commands again with the following output:

root@truenas[~]# lsblk -bo NAME,PTTYPE,TYPE,START,SIZE,PARTTYPENAME
NAME        PTTYPE TYPE    START          SIZE PARTTYPENAME
sda         gpt    disk          1000204886016 
└─sda1      gpt    part     2048 1000203091968 
nvme0n1     gpt    disk           240057409536 
├─nvme0n1p1 gpt    part     4096       1048576 BIOS boot
├─nvme0n1p2 gpt    part     6144     536870912 EFI System
├─nvme0n1p3 gpt    part  1054720   17179869184 Solaris /usr & Apple ZFS
└─nvme0n1p4 gpt    part 34609152  222336909312 Linux filesystem
  • root@truenas[~]# sudo sgdisk -p /dev/sda
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Model:                 
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 97F00230-E9CE-4FE7-AC4A-51A4EF9E2A8F
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3437 sectors (1.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      1953523711   931.5 GiB   BF01  data
  • root@truenas[~]# sudo sgdisk -p /dev/sda1
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************

Exact type match not found for type code 7200; assigning type code for
'Linux filesystem'
Exact type match not found for type code 6C00; assigning type code for
'Linux filesystem'

Warning! Secondary partition table overlaps the last partition by
1936159669 blocks!
You will need to delete this partition or resize it in another utility.
Disk /dev/sda1: 1953521664 sectors, 931.5 GiB
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 69949DB5-70EB-4BA6-B594-A4A538911719
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953521630
Partitions will be aligned on 32-sector boundaries
Total free space is 1920221950 sectors (915.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1      1920221984      3736432267   866.0 GiB   8300  Linux filesystem
   2      1936028192      3889681299   931.6 GiB   8300  Linux filesystem

Is it worth trying to save this pool? Or how about chalk it up to a learning experience?

well if it is possible to save it and the work is not tooo complex, it whould be great to save it.

So got the pool back online and copy all my needed Stuff from it and setup the pool again without the USB Drive.

What was my Solution for this Problem?!

I set the zfs_max_missing_tvds to 1 and import the Pool in read only with zpool import -o readonly=on vmpool . After that the main nvme was back online and i can reconnect them. After a second the USB Drive came back online too.