[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Feature request: nbd-server serves multiple (autogenerated) files in directory hierarchy



Hi there,

I'd like to have (and to implement) the following feature:

nbd-server shall be able to use an (auto-generated) set of multiple files in a directory hierarchy.

In detail:

1. config file contains
  * the base directory,
  * the total size of the exported block device,
  * he "chunk size" (=size of each file) and
  * how many files/subdirs are shall be stored per directory at maximum.

2. If the number of "chunk" files exceeds the number of allowed "files per directory", they are distributed in sub directories.

3. the nbd-server creates files & sub directories on demand when data are written to the exported block device. Reads from non-existent files are considered as null bytes.

4. If the block device region covered by a chunk file is "trimmed" and/or completely filled with null bytes the chunk file might be deleted automatically by the nbd-server (might be done lazy).

5. the "naming convention" of the file and directory names shall be implemented in a single function and might be configurable in later versions. The initial version can just use decimal numbers as directory names and number+".bin" as file names.


Some examples:

Case A: 1 GiB device size, 1 MiB chunk size, 2000 nodes per directory:
   -> 1024 chunks -> fit in one directory.
   $BASEDIR/0000.bin
   ...
   $BASEDIR/1023.bin

Case B: 1 TiB device size, 4 MiB chunk size, 2000 nodes per directory:
   -> 262144 chunks -> hierarchy depth of ceil(log(262144)/log(2000))=2.
   chunk #0: $BASEDIR/000/0000.bin
   ...
   chunk #1999: $BASEDIR/000/1999.bin
   chunk #2000: $BASEDIR/001/0000.bin
   ...
   chunk #3999: $BASEDIR/001/1999.bin
   ...
   chunk #262143: $BASEDIR/131/0143.bin  (if I calculated correctly)

Case C: 10 TB device, 64 KiB chunks, 1000 nodes per directory:
   -> 167'772'160 chunks -> hierarchy depth: 3.
   chunk #0:  $BASEDIR/000/000/000.bin
   ...
   chunk #167772160: $BASEDIR/167/772/160.bin


Please tell me your opinion, ideas and suggestions for this feature.

Greetings,

		Lars Rohwedder

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Reply to: