ibiRecovery

ibi Database Schema Documentation

Overview

This document provides complete schema documentation for ibi device databases recovered from data recovery operations. This information enables others to create parsers, recovery tools, and analysis scripts for ibi data.

Database Information

File Storage System

Physical Storage Structure

/restsdk/data/files/
├── a/               # Files with contentID starting with 'a'
│   ├── aB1C2D3E...  # Actual file (contentID as filename)
│   └── aF4G5H6I...
├── b/               # Files with contentID starting with 'b'
├── ...
└── z/

Storage Formula

Core Tables Schema

Files Table (Primary Content)

CREATE TABLE Files(
    id TEXT NOT NULL PRIMARY KEY,                    -- Unique file identifier
    parentID TEXT REFERENCES Files(id),              -- Directory structure
    contentID TEXT UNIQUE,                           -- Maps to physical file storage
    version INTEGER NOT NULL,                        -- File version number
    name TEXT NOT NULL,                              -- Original filename
    birthTime INTEGER NOT NULL,                      -- Creation time (ms since epoch)
    cTime INTEGER NOT NULL,                          -- Data creation time
    uTime INTEGER,                                   -- Update time
    mTime INTEGER,                                   -- Data modification time
    size INTEGER NOT NULL DEFAULT 0,                 -- File size in bytes
    mimeType TEXT NOT NULL DEFAULT '',               -- MIME type
    storageID TEXT NOT NULL,                         -- Storage backend ('local')
    hidden INTEGER NOT NULL DEFAULT 1,               -- Visibility flag
    description TEXT NOT NULL DEFAULT '',            -- User description
    custom TEXT NOT NULL DEFAULT '',                 -- Internal hash/tracking
    creatorEntityID TEXT REFERENCES Entities(id),   -- User who created file

    -- Image metadata
    imageDate INTEGER,                               -- Image capture date (ms)
    imageWidth INTEGER NOT NULL DEFAULT 0,
    imageHeight INTEGER NOT NULL DEFAULT 0,
    imageCameraMake TEXT NOT NULL DEFAULT '',
    imageCameraModel TEXT NOT NULL DEFAULT '',
    imageAperture REAL NOT NULL DEFAULT 0,
    imageExposureTime REAL NOT NULL DEFAULT 0,
    imageISOSpeed INTEGER NOT NULL DEFAULT 0,
    imageFocalLength REAL NOT NULL DEFAULT 0,
    imageFlashFired INTEGER,
    imageOrientation INTEGER NOT NULL DEFAULT 0,
    imageLatitude REAL,                              -- GPS coordinates
    imageLongitude REAL,
    imageAltitude REAL,
    imageCity TEXT NOT NULL DEFAULT '',              -- Location names
    imageProvince TEXT NOT NULL DEFAULT '',
    imageCountry TEXT NOT NULL DEFAULT '',

    -- Video metadata
    videoDate INTEGER,                               -- Video capture date (ms)
    videoCodec TEXT NOT NULL DEFAULT '',
    videoWidth INTEGER NOT NULL DEFAULT 0,
    videoHeight INTEGER NOT NULL DEFAULT 0,
    videoDuration REAL NOT NULL DEFAULT 0,           -- Duration in seconds
    videoOrientation INTEGER NOT NULL DEFAULT 0,
    videoLatitude REAL,                              -- GPS coordinates
    videoLongitude REAL,
    videoAltitude REAL,
    videoCity TEXT NOT NULL DEFAULT '',              -- Location names
    videoProvince TEXT NOT NULL DEFAULT '',
    videoCountry TEXT NOT NULL DEFAULT '',

    -- Audio metadata
    audioDuration REAL NOT NULL DEFAULT 0,
    audioTitle TEXT NOT NULL DEFAULT '',
    audioAlbum TEXT NOT NULL DEFAULT '',
    audioArtist TEXT NOT NULL DEFAULT '',

    -- Additional fields...
    category INTEGER,                                -- File categorization
    month INTEGER NOT NULL DEFAULT 0,               -- Time grouping
    week INTEGER NOT NULL DEFAULT 0
);

FileGroups Table (Albums/Collections)

CREATE TABLE FileGroups(
    id TEXT NOT NULL PRIMARY KEY,                   -- Unique album identifier
    name TEXT NOT NULL,                             -- Album name
    previewFileID TEXT REFERENCES Files(id),       -- Preview/cover image
    cTime INTEGER NOT NULL,                         -- Creation time (ms)
    mTime INTEGER,                                  -- Modification time (ms)
    description TEXT NOT NULL DEFAULT '',          -- Album description
    estCount INTEGER NOT NULL DEFAULT 0,           -- Estimated file count
    estMinTime INTEGER,                             -- Earliest content time
    estMaxTime INTEGER,                             -- Latest content time
    creatorEntityID TEXT REFERENCES Entities(id),  -- Album creator
    post INTEGER NOT NULL DEFAULT 0,               -- Post/sharing flag
    commentsCount INTEGER NOT NULL DEFAULT 0       -- Number of comments
);

FileGroupFiles Table (Many-to-Many Relationship)

CREATE TABLE FileGroupFiles(
    id TEXT NOT NULL PRIMARY KEY,                   -- Unique relationship ID
    fileID TEXT NOT NULL REFERENCES Files(id),     -- File reference
    fileGroupID TEXT NOT NULL REFERENCES FileGroups(id), -- Album reference
    fileCTime INTEGER NOT NULL,                     -- File creation time for sorting
    cTime INTEGER NOT NULL,                         -- Relationship creation time
    changeID INTEGER NOT NULL DEFAULT 0,           -- Change tracking
    creatorEntityID TEXT REFERENCES Entities(id),  -- Who added file to album
    commentsCount INTEGER NOT NULL DEFAULT 0       -- Comments on this relationship
);

FilesTags Table (AI-Generated Content Tags)

CREATE TABLE FilesTags(
    fileID TEXT NOT NULL REFERENCES Files(id),     -- File reference
    tag TEXT NOT NULL,                             -- Content tag (e.g., "person", "beach")
    auto INTEGER NOT NULL                          -- 1 = AI-generated, 0 = manual
);

Entities Table (Users/Devices)

CREATE TABLE Entities(
    id TEXT NOT NULL PRIMARY KEY,                   -- Internal entity ID
    extID TEXT NOT NULL,                           -- External ID (auth0, device UUID)
    type INTEGER NOT NULL,                         -- 1=user, 2=device, 4=other
    rootID TEXT REFERENCES Files(id),             -- Root directory
    cTime INTEGER NOT NULL,                        -- Creation time
    version INTEGER NOT NULL,                      -- Version number
    timeZoneName TEXT NOT NULL DEFAULT '',        -- IANA timezone (e.g., "America/Los_Angeles")
    lang TEXT NOT NULL DEFAULT ''                 -- Language code (e.g., "en-US")
);

Metadata Categories

✅ Portable/Useful Data

❌ ibi Ecosystem-Specific (Not Portable)

Common Queries

Get All Files with Basic Info

SELECT f.id, f.name, f.contentID, f.mimeType, f.size,
       f.imageDate, f.videoDate, f.cTime
FROM Files f
WHERE f.contentID IS NOT NULL AND f.contentID != ''
ORDER BY COALESCE(f.videoDate, f.imageDate, f.cTime);

Get Files with AI Tags

SELECT f.name, ft.tag
FROM Files f
JOIN FilesTags ft ON f.id = ft.fileID
WHERE ft.auto = 1
ORDER BY f.name, ft.tag;

Get Album Contents

SELECT fg.name AS album_name, f.name AS filename
FROM FileGroups fg
JOIN FileGroupFiles fgf ON fg.id = fgf.fileGroupID
JOIN Files f ON fgf.fileID = f.id
ORDER BY fg.name, fgf.fileCTime;

Get Files with GPS Data

SELECT f.name, f.imageLatitude, f.imageLongitude,
       f.imageCity, f.imageCountry
FROM Files f
WHERE f.imageLatitude IS NOT NULL
   AND f.imageLongitude IS NOT NULL;

Statistics (Typical Dataset)

File Recovery Process

  1. Database Connection: Open /restsdk/data/db/index.db
  2. File Mapping: Use contentID to locate physical files
  3. Metadata Extraction: Join Files, FilesTags, FileGroups tables
  4. File Retrieval: Copy from /files/{contentID[0]}/{contentID}

Version Information

This schema documentation is based on analysis of recovered ibi databases with the following identified characteristics:

Database Version Identifiers

Feature Set Detected

Time Period

Hardware/Platform Indicators

Note: This represents ibi software that was in use during 2017-2023 with database schema version 166. Different ibi versions may have different schemas, but this documentation covers the format found in typical consumer ibi devices from this era.

Complete Table List

Core tables: Files, FileGroups, FileGroupFiles, FilesTags, Entities

Supporting tables: CategoriesStats, Changes, Comments, DevicePerms, ExtraContents, FilesKeywords, Filesystems, Info, MediaTimeGroups, Reactions, Settings, SharedFiles, Volumes

ibi-specific: CloudFilesystems, CloudFilesystemFiles, DeletedContent, FilePerms, FileGroupPerms, ResumableFiles, PendingFilePermUpdates

Search/indexing: FilesFTS, FilesFTS_* (Full-text search tables)

Usage License

This schema documentation is released under CC0 (Public Domain) to benefit the data recovery community. Use freely for:

Contributing

If you discover additional schema details, variations, or corrections, please contribute back to help others in the data recovery community.