owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.37k stars 180 forks source link

orphan files/folders on harddrive #6964

Open individual-it opened 1 year ago

individual-it commented 1 year ago

Describe the bug

My instance uses much more storage on the disk than expected. When looking into what files use the space I found files on the disk that I have deleted in ocis e.g. storage/users/spaces/00/7f0f4e-cb0c-4d60-a229-180920aa97ec/blobs/97/79/ab/b8/-bbea-4d25-bee8-d418129a5568

The messagepack of that file has this content:

{
  "user.ocis.blobid": "9779abb8-bbea-4d25-bee8-d418129a5568",
  "user.ocis.blobsize": "10139136",
  "user.ocis.cs.adler32": "\ufffdLwv",
  "user.ocis.cs.md5": "\u0014\ufffd\ufffd{\ufffdĮH\ufffd@0\ufffdh\ufffd\ufffd\ufffd",
  "user.ocis.cs.sha1": "\ufffd\ufffd\ufffd\u001f\u0015\ufffdENlJu\ufffd\ufffd\u001c˲Ssp\ufffd",
  "user.ocis.name": "P1120390.JPG",
  "user.ocis.parentid": "dbd28bd2-27fb-4f8c-92b7-40fa31753e37",
  "user.ocis.type": "1"
}

I can find it's parent on disk:

ls ./storage/users/spaces/00/7f0f4e-cb0c-4d60-a229-180920aa97ec/nodes/db/d2/8b/d2/-27fb-4f8c-92b7-40fa31753e37 -lh
total 0
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:30 P1120306-Glückwunsch.JPG -> ../../../../../b1/10/38/22/-880f-439d-956e-9135ef9af288
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120306.JPG -> ../../../../../41/d4/bb/fa/-0580-4732-a28e-f5c228bbdb98
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120307.JPG -> ../../../../../88/2c/73/2f/-83d0-4dee-bd1e-d727069bb5f2
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120309.JPG -> ../../../../../cb/39/0b/2f/-41d6-40c9-8581-9e93b6ac4e43
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120313.JPG -> ../../../../../f3/f5/4d/fc/-8078-4ae6-9af3-2d5cf7bcdd2d
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120315.JPG -> ../../../../../11/5c/28/03/-087e-4522-ade0-1d73c21007f5
lrwxrwxrwx 1 arturproxy arturproxy 55 Jul  4 11:31 P1120317.JPG -> ../../../../../5f/d5/19/0a/-c019-4a92-adbd-830daf8af264
....

The parent has this messagepack content:

{
  "user.ocis.name": "2022-04-18-22-Bandipur-Urlaub",
  "user.ocis.parentid": "4629d530-c6f7-4fdf-ab4c-8ce3025a9d9c",
  "user.ocis.propagation": "1",
  "user.ocis.tmp.etag": "",
  "user.ocis.tmtime": "2023-07-04T09:36:22.416708035Z",
  "user.ocis.treesize": "951625660",
  "user.ocis.type": "2"
}

These are files that I have deleted previously, including the folder.

I cannot find that folder or the files in the ocis webUI, nor the but not the grand-parent with the id 4629d530-c6f7-4fdf-ab4c-8ce3025a9d9c anywhere on disk

Steps to reproduce

Not sure! But I have uploaded a lot of files, generated previews (what sometimes crashed), deleted files, created & deleted spaces

Expected behavior

no orphan files/folders on harddrive

Actual behavior

orphan files/folders exist on the harddrive

Setup

docker compose

```yml --- version: "3.7" services: ocis: image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest} networks: ocis-net: ports: - "9200:9200" entrypoint: - /bin/sh command: [ "-c", "ocis init || true; ocis server" ] environment: OCIS_URL: https://${OCIS_DOMAIN:-ocis.in-nepal.de} OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info} OCIS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}" OCIS_INSECURE: true PROXY_HTTP_ADDR: 0.0.0.0:9200 PROXY_TLS: false OCIS_CACHE_STORE: "redis" OCIS_CACHE_STORE_NODES: "cache:6379" OCIS_LOG_FILE: /var/log/ocis/ocis.log restart: always depends_on: - cache volumes: - type: bind source: /mnt/HC_Volume_32687865/ocis-config target: /etc/ocis - type: bind source: /mnt/HC_Volume_32687865/ocis-data target: /var/lib/ocis - type: bind source: /mnt/HC_Volume_32687865/ocis-logs target: /var/log/ocis cache: image: redis:6.2-alpine restart: always networks: ocis-net: volumes: - cache:/data networks: ocis-net: volumes: cache: driver: local ```

Additional context

Add any other context about the problem here.

cartons-taller commented 9 months ago

I believe I've also ran into this issue. I've replicated it by permanently deleting a folder containing files; oCIS will report that deletion was successful, the folder will disappear from the trash bin, but the files contained within that folder will remain on disk.

Selecting all the files individually, sending to trash + perma-deleting will work as expected.

I initially ran into this issue 6 month ago. My oCIS 4.0.0 Docker instance (with Keycloak IDP + Apache Tika, Debian 11 LXC in Proxmox VE 8.1) was using a whopping 29TB of space, despite oCIS reporting a total size of 9.8TB via the web interface.

I then followed the Binary Setup guide and migrated my data to a 2nd instance of oCIS 4.0.4 (with Keycloak IDP + Apache Tika, Debian 12 LXC in Proxmox VE 8.1) and can confirm the issue is still present.

File permissions were setup correctly on both instances. The orphaned files/folders in /var/lib/ocis/storage/ also had correct permissions. Both LXCs were each installed onto their own ZFS RAIDz1 dataset.

I've recorded a video (can't upload directly) where I recreate this issue on a fresh oCIS 4.0.4 instance (with Apache Tika, Debian 12 LXC in Proxmox VE 8.1, this time installed onto a ZFS dataset on a new NVME drive).

The top left window contains statistics on the LXC's total HDD usage, which reveals whether a perma-deletion succeeds or fails. There's also a live journal log for both oCIS and Apache Tika Server.

As you can see, I'm able to successfully upload + select individual files for perma-deletion as expected, but selecting a folder for perma-deletion results in orphaned files.

1st instance's docker-compose.yml:

version: '3.8'

services:
    ocis:
        image: owncloud/ocis
        container_name: ocis
        networks:
            ocis-net:
        ports:
            - '9200:9200'
        entrypoint:
            - /bin/sh
        command: ["-c", "ocis init || true; ocis server"]
        environment:
            - OCIS_INSECURE=true
            - PROXY_HTTP_ADDR=0.0.0.0:9200
            - OCIS_URL=https://ocis.[redacted].com
            - DEMO_USERS=false
            - PROXY_TLS=false
            - OCIS_LOG_LEVEL=info
            # Use Keycloak IDP
            - OCIS_OIDC_ISSUER=https://keycloak.[redacted].com/realms/ocis
            - PROXY_AUTOPROVISION_ACCOUNTS=true
            - PROXY_OIDC_REWRITE_WELLKNOWN=true
            - WEB_OIDC_CLIENT_ID=ocis-web
            - OCIS_ADMIN_USER_ID=9efa99a9-2ddb-40bb-adc5-49511ef1f953
            # Use Apache Tika indexer
            - SEARCH_EXTRACTOR_TYPE=tika
            - SEARCH_EXTRACTOR_TIKA_TIKA_URL=http://apache-tika:9998
            - FRONTEND_FULL_TEXT_SEARCH_ENABLED=true
        volumes:
            - ${PWD}/config:/etc/ocis
            - ${PWD}/data:/var/lib/ocis
        restart: always
    apache-tika:
        image: apache/tika
        container_name: apache-tika
        networks:
            ocis-net:
        ports:
            - '9998:9998'
        restart: always
networks:
    ocis-net:
        name: ocis-net
danth commented 9 months ago

I can confirm this is still present in 5.0.0-rc.1.

It happens regardless of whether the trash is emptied through the UI, or items are left to expire with ocis storage-users trash-bin purge-expired.

HerzogVonWiesel commented 7 months ago

I can report this issue as well and had opened a community post about it: https://central.owncloud.org/t/deleting-files-but-disk-space-is-still-used/47038

leepfrog-ger commented 7 months ago

Can confirm that this is happening for me under 5.0.0-rc.3 as well

individual-it commented 2 days ago

In the meanwhile I've completely cleaned up my instance by copying all data to a new user/space and deleting the old spaces. I do nightly backups (shutdown ocis, copy all files with rsnapshot, start ocis) and after success I check the backup using the backup consistency ocis command. All has been fine for a week or so, but yesterday I've been working on some files (uploading through the desktop client, editing in the text file viewer, viewing the file in the presentation viewer) and on today's backup I have orphaned blobs:

🚨 Inconsistent Blobs:
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/39/ba/10/4d/-ea12-4f6a-9e7b-87cbd40e06d1
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/3e/cd/66/75/-1b10-4189-9d15-4b0c02651ae6
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/52/ae/b7/a5/-3bcf-48a5-9f9f-6a6cb577db3d
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/67/b8/c8/6e/-a033-4d48-9753-dc69000e0e37
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/d3/f3/5b/0d/-c3a4-4d6c-a717-09162b12ab7c
    👉️ [blob orphaned]  blob: /var/lib/ocis/storage/users/spaces/bd/be95cd-a66e-4add-ace5-88dc58598eb2/blobs/db/dc/8e/91/-1a34-4856-aecf-32e95d3a99a3

the content of most of those blobs are various versions of the .md files I've mostly worked with yesterday. BTW: the real storage of ocis shows the same result, so the issue is not in the backup process itself.

Currently I'm running: Version 6.4.0 Web client version 10.2.0