New NCP installation with older data drive

Greetings,
after a few years of NCP running out of a USB stick, suddenly I cant access it any longer.
Long story short… it looks like the sandisk (64GB) got corrupted. As a result, it gives message that cannot be mounted and that is read only. There are 2 partition: sdx1 and sdx2 the sdx2 is the rootfs and that id not readable anymore (even if the message says is read only!)
Reading some forums I found out that Sandisk has a sort of fsailsafe and put itself in read only mode when corrupted.
I tried to retrieve the data or fix it but no success.
QUEST:
i figure is best to create a new usb key installation.
I do have ajn external data disk that I like to keep. I have years of backups and shares among 3-4 users (family mased) that also use NCP as alternative to google.
Can someone give me tips for best practice how to achieve this?
What do I have to do to be able to end up with same apps and shares and users?
Is it even possible?
Thank you

With the data, you probably can just restore the same users and put back their data into their folders (and use occ files:scan to update the fileindex)

Most app data, and a lot of meta data like the sharing information, is stored in the database. Therefore it is important to have a full backup including the database.

Thanks tflidd.
As I dont have access to my rootfs, I cant start NCP to check backups.
I do know I make regular and automatic backups.
From your suggestion sounds like once NCP is installed, I can access the usb drive and restore the backup that in turn will restore users and DB. Provided I run the file scan after it.
Am I correct?

It’s too early to state this. First you should clone the usb-device with dd. Than you can inspect the partitions and filesystems of that clone, and than …

Understanding your situation.
But consider making backups on NOT SSD like media. And keep them not on thye same drive as the production instance.

I assume you mean the usb key/stick I use for the OS with the NC installed, right?
My data is on a external 4TB drive.
As I mentioned, my rootfs seem to be corrupted and cant access the rootfs partition.
If I dd it, do you think I can bypass the corruption issue?
If that is the case, I could clone it back to an other usb key …
I tried with testdisk but could not get anything from that partition.

I use NCP on a usb stick and the data is on a external 4TB drive (not SSD. Is a nas WD HDD)

What to do with an assumption - we need evidence!

I’m no expert, but as said before do make a copy/clone of the device in question. Only fiddle around with this copy/clone.
Then try to investigate .

Assumed corruption should be dicovered and thn may be repaired.
I don’t know testdisk, but what has it discovered?
To be honest, we have nothing we can talk about, we need test-results.

Lets say… I cantg mount the usb in any way: manually or automatically.
Sandisk is known to put its keys in read only mode when corrupted (they say) for safety reasons… I did make an image…
I used testdisk and prior to it gparted … even gparted cant do anything…
but I will explore more… I check it with fdisk as well…
If you have a suggestion for evidence, is welcome.

Do you have any kernel-messages (dmesg)?
What system is it running on? x86 arm/pi? mac
Do you have another pc/pi/mac to check?
Do you have other usb-sticks/sd-cards or similar to dd on?
Which os do you use to do your investigation?
So many questions… :grinning:

So yes, I do have a kernel panic:

# Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block
I use a raspberry pi 4B headless. I took the Pi and attached it to my TC so I could see the kernel panic message.
Pi is an ARM processor (64bit)
Took the usb key and put that on my Linux laptop and checked with: fdisk /dev/sdb
The results: fdisk: cannot open /dev/sdb: Read-only file system
I use linux mint to investigate.

However, I am ok on creating a new install (raspberry pi OS and NCP on it).
I would like to know if I then can restore backups from (I hope I have them there) my older installation that should be on my DATA drive.
The usb corruption is great to solve but I would not trust this usb pendrive anymore.
The only reason why I would use is if it is necessary to have a system as I had it before when the backup is not enough.

Nice, so we talk about a vfat boot-partition ~200MB.
What about lsblk, lsusb on Mint or dmesg?

To my knowledge it is the way to go, read the actual doc, but some fiddling with pathes may occur, backups shouldn’t to old. But I have no personal experience.

So you have your backups to fiddle later, and may now go for a new setup, good luck.

lsblk:

sdb           8:16   1  57,3G  1 disk 
├─sdb1        8:17   1   256M  1 part /media/master/boot
└─sdb2        8:18   1    57G  1 part 
lsusb
Bus 002 Device 004: ID xxxx:xxxx SanDisk Corp. Ultra Fit

Usually cite full command input and output
ex.

pi@nextcloudpi:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 223,6G 0 disk
├─sda1 8:1 0 256M 0 part /boot
└─sda2 8:2 0 223,3G 0 part /
sdb 8:16 1 119,1G 0 disk
└─sdb1 8:17 1 119,1G 0 part /media/ncp-backup
pi@nextcloudpi:~ $

pi@nextcloudpi:~ $ sudo lsusb -v -s 002:002

Bus 002 Device 002: ID xxxx:yyyy SanDisk Corp. iXpand Flash Drive
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0781 SanDisk Corp.
idProduct 0xcff6
bcdDevice 1.00
iManufacturer 1 SanDisk
iProduct 2 iXpand Flash Drive
iSerial 3 8616149EF18D
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x002c
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 152mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0016
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000002
HIRD Link Power Management (LPM) Supported
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000e
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 2047 micro seconds
Device Status: 0x000d
Self Powered
U1 Enabled
U2 Enabled
pi@nextcloudpi:~ $
Output of an sandisk-stick

I can’t detect unusual.

lsusb -v -s 002:004

Bus 002 Device 004: ID 0781:5583 SanDisk Corp. Ultra Fit
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0781 SanDisk Corp.
  idProduct          0x5583 Ultra Fit
  bcdDevice            1.00
  iManufacturer           1 SanDisk
  iProduct                2 Ultra Fit
  iSerial                 3 0501a1bcc6b32a762ad78766e123e53c3d678038e7ac3c81e1ea886dfbfd2447375b0000000000000000000083ff2a63009c06108355810762a631a5
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x002c
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      HIRD Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat         256 micro seconds
Device Status:     0x0000
  (Bus Powered)

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdb           8:16   1  57,3G  1 disk 
├─sdb1        8:17   1   256M  1 part /media/master/boot
└─sdb2        8:18   1    57G  1 part 

for the lsblk I copied only the relevant dev.
The list is long but irrelevant as I am doing this on my linuxmint and I have several /dev here.
I cant run that on the Pi as I cant access it remotely anymore (due to the corruption).

As I understand you are running the stick-copy on your Mint-Laptop.
What does cfdisk and fsck.vfat results are on “/dev/sdb1”?

fsck.vfat /dev/sdb1
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]? 

cfdisk /dev/sdb1
first a empty screen with a warning message: 
Device already contains a vfat signature; it will be removed by a write command.
                            Press a key to continue.
When continue:
 Disk: /dev/sdb1
                 Size: 256 MiB, 268435456 bytes, 524288 sectors
                       Label: dos, identifier: 0x00000000

    Device        Boot       Start       End    Sectors     Size    Id Type
>>  Free space                2048    524287     522240     255M                

Device is currently in use, repartitioning is probably a bad idea.
                      Create new partition from free space

But… why you asking for /dev/sdb1? that is the boot partition I can mount… the sdb2 is the problem. or so it seems.
if I do cfdisk on sdb2 I got this:

cfdisk /dev/sdb2
cfdisk: cannot open /dev/sdb2: Read-only file system

PS
I am now working on the the actual usb plugged on my laptop, not the copy of it.

BTW
maybe copying the backup to the original could resolve the issue?

(Its a bit late here, I will read your answers tomorrow. Thanks for helping)

Sorry, yes it is late and I don’t produce any good if at all.
Have a good night.