Ncp error "no data dir found" after reboot of pi

Nextcloud version (eg, 12.0.2):15.0.5.3
Operating system and version (eg, Ubuntu 17.04): nextcloudpi 4.19.27-v7+
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.25
PHP version (eg, 7.1): 7.2.16-1

The issue you are facing:

 data dir not found

I have a 1tb hdd attached, it is up an spinning.
It worked before with nc and nc-automount enabled.
However, the USB does NOT show up with

ls -l /media  --->   "total 0"

Yet with

lsusb -v --->  
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x152d JMicron Technology Corp. / JMicron USA Technology Corp.
  idProduct          0x0567 JMS567 SATA 6Gb/s bridge
  bcdDevice            1.17
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           85
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 
    bmAttributes         0xc0
      Self Powered
    MaxPower               30mA

So it seems to be connected fine just unable to mount/open for some reason?

Im fairly new to this all so I don’t know what to do as it was working fine before the reboot.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it (in theory, haven’t been able to test it as the HDD is not mounting):

  1. Shutdown ncp
  2. restart ncp
  3. nc-fix permissions

As I have data on the drive wich hasn’t been backed up i need a way to access the USB Drive to copy the data.
The USB HDD is formatted btrfs as nc suggests.

Any Help is Appreciated, Thanks :slight_smile:

You can mount your disk on any up-to-date Linux supporting BTRFS (e.g. ubuntu).
Please do your backup first.

If the volume could be mounted before, it probably won’t help, trying to mount it on another host, as the OS on the RPi also supports btrfs.

I’d rather try the volume in either some other enclosure or try another drive in the same enclosure to determine, if the enclosure/adapter is somewhat broken. If this is not the case, I’d suspect, that you are facing some broken btrfs and you should probaby take a look here, to try to fsck your btrfs volume:

https://btrfs.wiki.kernel.org/index.php/Btrfsck

1 Like

NEVER fsck your BTRFS volume, see

https://ownyourbits.com/2019/03/03/how-to-recover-a-btrfs-partition/

1 Like

@nachoparker Very nice write-up on how to tackle btrfs issues!

Well… I knew btrfs was a bitch…, that’s why I wouldn’t use on my drives. Hopefully, you will be able to get your drive at least partially going again to be able to salvage your data from it. I’d never recommend a btrfs volume on a songle drive USB on a RPi anyway.

Performance will not be a question, regadless of what fs you’ll use over USB, so why not stay with some rock solid as ext4.

thanks!

BTRFS is a beast, but it is more complicated. It is much better for holding data, as explained in the article, but it is more involved to recover from failure.

With ext4 you get the data corruption just the same, but you don’t even notice

This is because it is more advanced, and tries really hard not to make things worse.

I didn’t intend to downplay btrfs capabilities - I only tried to express my view regarding btrfs in the hands of “casual” NC admins. Also, as you mentioned in the post, btrfs needs reliable hardware and connections and I don’t deen USB reliable in any way.

I have been using ZFS for the last 8 years and I love it - it even has no fsck, since it’s always consistent by design, much like btrfs. But then the fun starts once you face a situation, where the on-disk data is corrupted.

You surely can get a corrupted ext4 of XFS but in my opinion, this can be handled easier for normal people.

Thanks so much too all for the input.

When trying to mount the drive i get the following error:

wrong fs type, bad option, bad superblock on /dev/sda,
       missing codepage or helper program, or other error

in

dmesg -w
[226017.391105] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0xfc63daf)
[226017.391113] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[226017.391805] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[226017.391813] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock
[226017.391837] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0xfc63daf)
[226017.391841] F2FS-fs (sda): Can't find valid F2FS filesystem in 1th superblock
[226017.391845] F2FS-fs (sda): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[226017.391848] F2FS-fs (sda): Can't find valid F2FS filesystem in 2th superblock

when i try to mount the Drive instead of a partition i get the following error (in demsg -w):

[226938.379790] BTRFS info (device sda1): disk space caching is enabled
[226938.379800] BTRFS info (device sda1): has skinny extents
[226938.379803] BTRFS info (device sda1): flagging fs with big metadata feature
[226938.383128] BTRFS error (device sda1): parent transid verify failed on 20987904 wanted 5 found 8548
[226938.386529] BTRFS error (device sda1): parent transid verify failed on 20987904 wanted 5 found 8548
[226938.386549] BTRFS error (device sda1): failed to read chunk root
[226938.446541] BTRFS error (device sda1): open_ctree failed

sudo fdisk -l

shows me as follows:

Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: ----

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    98045    89854 43.9M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      98304 62333951 62235648 29.7G 83 Linux


Disk /dev/zram0: 231.5 MiB, 242765824 bytes, 59269 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/zram1: 231.5 MiB, 242765824 bytes, 59269 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/zram2: 231.5 MiB, 242765824 bytes, 59269 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/zram3: 231.5 MiB, 242765824 bytes, 59269 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: ----

Device     Start        End    Sectors   Size Type
/dev/sda1   2048 1953523711 1953521664 931.5G Linux filesystem

@nachoparker am I approaching this wrong, or is the drive a lost case?
It would be really awesome to be able to save the data on the drive…

I assume that the error occurred due to an unavoidable power loss as described here:
https://github.com/nextcloud/nextcloudpi/issues/119#issuecomment-473604230

PS. Sorry if this causes you to hit your head in disbelief… I’m fairly new to diving this deep into HDD architecture.

Can you share the mount command you tried to mount the partition - pasteing the output alone, doesn’t give much information

Also, what is the resp. mount command in /etc/fstab for that volume?

yes of course… I have tried multiple commands for both the drive and partition:

sudo mount -o ro /dev/sda /mnt

sudo mount -o usebackuproot /dev/sda /mnt

scrubbing also doesn’t work with either the error:

btrfs scrub start /mnt
     ERROR: not a btrfs filesystem: /mnt

sudo btrfs scrub start /dev/sda
     ERROR: '/dev/sda' is not a mounted btrfs device

/etc/fstab as follows:

PARTUUID=----  /boot           vfat    defaults          0       2
PARTUUID=----  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

I believe the HDD isn’t even listed here, but only the SD card.

sudo cfdisk

lists the drive as follows:

Partition name: primary                                                                                                                                                     │
 │  Partition UUID: ----                                                                                                                       │
 │  Partition type: Linux filesystem (----)                                                                                                     │
 │ Filesystem UUID: ----                                                                                                                      │
 │Filesystem LABEL: myCloudDrive                                                                                                                                                │
 │      Filesystem: btrfs  

so it definitely is formatted as a btrfs.