borg icon indicating copy to clipboard operation
borg copied to clipboard

LTFS-capable tape drive and borg?

Open ThomasWaldmann opened this issue 9 years ago • 19 comments

https://en.wikipedia.org/wiki/Linear_Tape_File_System

Can somebody with this software / hardware try it with borg and post the outcome?

Note:

  • guess this is a case for a append_only repository (see repository/config).
  • borg 1.0 defaults to 5MB per segment file, borg 1.1 to 500MB (can be modified in repo config)
  • one could try to put all repo/ files on ltfs or just repo/data/

ThomasWaldmann avatar Oct 12 '17 17:10 ThomasWaldmann

@ThomasWaldmann I have a LTO4 tape drive is that if what you are looking for?

Its not connected to a machine but I can set it up, if no one else comes forward with an already working setup.

It would be fantastic to use borg with it though 👍

mannp avatar Oct 13 '17 09:10 mannp

@mannp Check if there is LTFS software available for / working with it.

ThomasWaldmann avatar Oct 13 '17 11:10 ThomasWaldmann

@ThomasWaldmann ok will find out and come back to you.

Edit:

Its a Quantum DLT-V4.

Doing a search and it seems supported drives are LT05 and not LT04 like mine, so perhaps not.

Searching some more incase there are workarounds.

mannp avatar Oct 13 '17 13:10 mannp

AIUI LTFS requires drive support and is only available with LTO5 or newer.

I'm not really sure whether Borg is useful for this, since AIUI LTFS does not allow one "volume" to span tapes. Hence you're limited to exactly one tape's worth of repository minus all overhead. Notice that LTFS is like a log with no garbage collection; deleting files does not free space.

enkore avatar Oct 13 '17 16:10 enkore

LTO Ultrium 8 == 12 TByte uncompressed

ThomasWaldmann avatar Oct 13 '17 17:10 ThomasWaldmann

A new LTO tape drive will cost you about 2000-3000 €...

enkore avatar Oct 13 '17 19:10 enkore

Let's say that a borg repo is put on tape (using this LTFS or not, eg. in a way that these big numbered chunks could be written as tape "files"). Since tapes like to be read sequentially, is "borg extract" acting in a tape-friendly way, ie. reading files in storage order?

zougloub avatar Dec 22 '17 19:12 zougloub

@zougloub guess it will be a mix of sequential and random accesses. hard to say how good (for a tape drive) the mix will be in practice.

ThomasWaldmann avatar Dec 22 '17 23:12 ThomasWaldmann

@ThomasWaldmann I got an LTO-5 drive 4 days ago (and stumbled upon this issue while googling if borg had anything for that); while LTFS should "work", as @enkore said these drives are expensive, and even if I got mine for peanuts, the first thing I checked was how these beasts age and it's a bit scary... they really don't like random access. So I'm figuring out this tape thing, and so far I'm not even planning to use LTFS until I understand what R/W patterns it causes and what are the standard use cases for this special filesystem.

From what I read (there's a repo on github here https://github.com/amiaopensource/ltfs/), LTFS uses LTO-5+ "partitions", in which the tape length is divided in 2 parts, one for the FS index (and "inline" data), and one for data chunks. This makes "seeking" in each region easier. Still, tape is not random-access. I also have a theory that this FS was designed to have unsuspecting customers perform accelerated aging of their drives ;)

So far, my opinion is that rather than badly using LTFS, borg would better have a "tape mode" which knows about tapes:

  • save better be write-only; I seem to recall that borg could resist hash collisions and that the potential dedupe block was read and compared to candidate data?
  • by default, big chunks: when writing to a tape drive you'd want to write a reasonable amount of data (GBs) at full rate and without interruption, which requires some thought (tape drive users either use proprietary backup software or something... always piped with mbuffer).
  • by default, write index on tape after every N chunks (create dummy chunks)... or else everything needs to be read to find the index... or LTO-specific technology use (partitions as LTFS does, or LTO chip memory)... or no index on tape
  • by default, chunks flushed to tape once complete
  • for extraction, there should be a way to restore the data that can extract then process the index, so then extraction happens while reading the whole tape in order, with a local cache (I suppose that would be needed, after a first pass at reading the index, plus optional temporary storage for sparse files generated from restoring deduplicated data).
  • converter between tape and disk repositories

I've used borg a lot and of course now that I have tapes, I'd enjoy using them for borg too, if that's possible without prematurely killing the drives. I will try to investigate current borg access patterns, figure out more tape stuff, and see whether the architecture is too much file-based or can operate over something else than a filesystem.

zougloub avatar Dec 26 '17 09:12 zougloub

There was an idea about a year or so ago about having pluggable repository drivers. The idea was (iirc) to mostly use a simplified version of the protocol used for remote repo access, document it, and then have the repository driver just be an executable (therefore, no language restrictions & as flexible as remote access) with a specific name mapping URIs to it (so, say, mt:///dev/mt0?partition=0 would have borg run something like borg-repository-driver-mt mt:///dev/mt0?partition=0 to access the repo).

It has never been pursued as far as I'm aware.

enkore avatar Dec 27 '17 14:12 enkore

@zougloub have you already tried to use Borg with the tape drive? What was the outcome? It seems that we've such a beast too, and now we a looking for a "seamless solution" if any exists, or ready to participate in development if it doesn't.

amorozov avatar Aug 23 '18 22:08 amorozov

I haven't even bothered (I'm using tar with tapes). An exercise to be clear about access patterns would be to run blktrace / seekwatcher on a isofs/squashfs-ed borg repository, to get an idea of the number of seeks on a non-fragmented media. Given that one seek is ~20 seconds and is a taxing operation (in terms of drive lifespan reduction), that should paint a clear picture.

zougloub avatar Aug 23 '18 22:08 zougloub

Ok, I see. Thus, our team has to be, huh, pioneers in the field. Not a role I'd enjoy, but anyway there's no choice ;) All in all, we're going to perform some testing and after that it looks like we have to make necessary changes for Borg to use it with the tape storage.

amorozov avatar Aug 24 '18 05:08 amorozov

I too would love to see pluggable repository drivers. Not just for tape access (without LTFS), but access for S3, Backblaze B2, WebDAV, and other protocols. Right now, for my use, Borgbackup's only major shortcoming is that the repository has to be either available via a random access volume locally or via SSH. By allowing for additional protocols, this would allow Borg Backup to be the primary choice for offsite stuff.

dfloyd888 avatar Dec 03 '18 16:12 dfloyd888

It's been a while and seems like nobody who has such hardware dared trying borg with LTFS. Maybe it is not even advisable, I don't know. Closing...

ThomasWaldmann avatar Mar 17 '19 23:03 ThomasWaldmann

Did some testing with borg and LTO5 LTFS this morning. Bash script ran the following:

  1. Create fake dataset.
  2. Initialise repo on HDD and LTO.
  3. Create archive on HDD and LTO.
  4. Modify 10% of files and add 10% of files.
    Repeat step 3 and 4 five times
  5. Delete odd number archives in HDD and LTO repo.
  6. Create archive on HDD and LTO.
  7. Modify 10% of files and add 10% of files.
    Repeat step 8 and 9 five times.

Got to the third archive on the tape before I had to end the script as it was working for 3 hours (versus the 6 min time it took to create the HDD archive). Unsure whether this was the container/ hardware causing issues, or whether ltfs was struggling to modify all the small files (suspect the latter). Will need more testing and playing around, particularly with the borg append-only option.

Also note in the log the differing duration times between the borg stats output and the time output. It appears borg finishes creating the archive and the tape drive is playing catchup trying to write the files.

If there's anything specific people want me to test, give me a shout.

Test log

  1. Create a rough initial synthetic dataset of:

    • x50,000 "xs" files between 1-100KB.
    • x10,000 "s" files between 100-1024KB.
    • x1,000 "m" files between 1-10MB.
    • x50 "l" files between 100-500MB.
    • x10 "xl" files between 500-1024MB.
    • x10 "xxl" files between 1-5GB.
      Note: each file size is split evenly between /dev/urandom and /dev/zero generated data.
  2. Initialised repo on HDD (with repokey encryption) and LTO tape (no Borg encryption).

       2022-01-03 05:07:47- Building 25000 files ranging from 1~100K  in xs/
       2022-01-03 05:15:09- Building 25000 files ranging from 1~100K  in xs/
       2022-01-03 05:22:47- Building 5000 files ranging from 100~1024K  in s/
       2022-01-03 05:25:06- Building 5000 files ranging from 100~1024K  in s/
       2022-01-03 05:26:36- Building 500 files ranging from 1~10M  in m/
       2022-01-03 05:27:48- Building 500 files ranging from 1~10M  in m/
       2022-01-03 05:28:12- Building 25 files ranging from 100~500M  in l/
       2022-01-03 05:31:21- Building 25 files ranging from 100~500M  in l/
       2022-01-03 05:32:12- Building 5 files ranging from 500~1024M  in xl/
       2022-01-03 05:33:46- Building 5 files ranging from 500~1024M  in xl/
       2022-01-03 05:34:14- Building 5 files ranging from 1~5G  in xxl/
       2022-01-03 05:41:20- Building 5 files ranging from 1~5G  in xxl/
    
       2022-01-03 05:42:41- Initialising HDD Borg repo
       2022-01-03 05:42:44- Initialising LTO Borg repo
    
  3. Create archive No. 0 on HDD (with default compression)

     2022-01-03 05:43:13- Starting HDD Benchmark No. 00
     ------------------------------------------------------------------------------
     Archive name: benchmark00
     Archive fingerprint: 5468edb1a2bc823f7ee589a6e2d3e43f21c4daa493280ff8500b53574fb87804
     Time (start): Mon, 2022-01-03 05:43:13
     Time (end):   Mon, 2022-01-03 06:02:50
     Duration: 19 minutes 37.28 seconds
     Number of files: 61083
     Utilization of max. archive size: 0%
     ------------------------------------------------------------------------------
                    Original size      Compressed size    Deduplicated size
     This archive:               74.62 GB             39.35 GB             39.21 GB
     All archives:               74.62 GB             39.35 GB             39.21 GB
    
                    Unique chunks         Total chunks
     Chunk index:                   45345                78323
     ------------------------------------------------------------------------------
    
     real	19m38.537s
     user	4m14.784s
     sys	1m58.705s
    
  4. Create archive No. 0 on LTO (with no compression)

     2022-01-03 06:02:51- Starting LTO Benchmark No. 00
     ------------------------------------------------------------------------------
     Archive name: benchmark00
     Archive fingerprint: cf23c2a0f59392a70140b538093f5183300c4075b960abefaa6aa1f487435135
     Time (start): Mon, 2022-01-03 06:02:55
     Time (end):   Mon, 2022-01-03 06:17:06
     Duration: 14 minutes 11.35 seconds
     Number of files: 61083
     Utilization of max. archive size: 0%
     ------------------------------------------------------------------------------
                            Original size      Compressed size    Deduplicated size
     This archive:               74.62 GB             74.62 GB             39.64 GB
     All archives:               74.62 GB             74.62 GB             39.64 GB
    
                            Unique chunks         Total chunks
     Chunk index:                   45407                78385
     ------------------------------------------------------------------------------
    
     real	15m9.737s
     user	3m24.679s
     sys	1m44.512s
    
  5. Modify 10% of all files and add 10% of each file type.

     2022-01-03 06:18:01- Modifying 5000  files in xs/
     2022-01-03 06:19:14- Modifying 1000  files in s/
     2022-01-03 06:19:41- Modifying 100  files in m/
     2022-01-03 06:19:55- Modifying 5  files in l/
     2022-01-03 06:20:23- Modifying 2  files in xl/
     2022-01-03 06:20:58- Modifying 2  files in xxl/
     2022-01-03 06:23:01- Adding 5500  files to xs/
     2022-01-03 06:23:02- Adding 1100  files to s/
     2022-01-03 06:23:02- Adding 110  files to m/
     2022-01-03 06:23:02- Adding 5  files to l/
     2022-01-03 06:23:09- Adding 2  files to xl/
     2022-01-03 06:23:31- Adding 2  files to xxl/
    
  6. Create archive No. 1 on HDD (with default compression)

     2022-01-03 06:25:34- Starting HDD Benchmark No. 01
     ------------------------------------------------------------------------------
     Archive name: benchmark01
     Archive fingerprint: 5cac489ee84e4a8c68168e81358b14ae062a46a34a9fcb176f15b6b2a165020c
     Time (start): Mon, 2022-01-03 06:25:36
     Time (end):   Mon, 2022-01-03 06:31:36
     Duration: 6 minutes 0.05 seconds
     Number of files: 67198
     Utilization of max. archive size: 0%
     ------------------------------------------------------------------------------
                            Original size      Compressed size    Deduplicated size
     This archive:               90.90 GB             55.70 GB             16.34 GB
     All archives:              165.51 GB             95.05 GB             55.56 GB
    
                            Unique chunks         Total chunks
     Chunk index:                   57438               168733
     ------------------------------------------------------------------------------
    
     real	6m2.988s
     user	1m26.573s
     sys	0m40.221s
    
  7. Create archive No. 1 on LTO (with no compression)

     2022-01-03 06:31:37- Starting LTO Benchmark No. 01
     ------------------------------------------------------------------------------
     Archive name: benchmark01
     Archive fingerprint: 9231bf54f198a2350971d30cc347ac760825c8953ce73aad6ebd350f05ea248b
     Time (start): Mon, 2022-01-03 06:31:50
     Time (end):   Mon, 2022-01-03 06:36:10
     Duration: 4 minutes 19.67 seconds
     Number of files: 67198
     Utilization of max. archive size: 0%
     ------------------------------------------------------------------------------
                            Original size      Compressed size    Deduplicated size
     This archive:               90.90 GB             90.90 GB             16.28 GB
     All archives:              165.51 GB            165.51 GB             55.92 GB
    
                            Unique chunks         Total chunks
     Chunk index:                   57529               168885
     ------------------------------------------------------------------------------
    
     real	10m34.469s
     user	1m6.896s
     sys	0m34.157s
    
  8. Modify 10% of all files and add 10% of each file type.

     2022-01-03 06:42:12- Modifying 5500  files in xs/
     2022-01-03 06:43:35- Modifying 1100  files in s/
     2022-01-03 06:44:04- Modifying 110  files in m/
     2022-01-03 06:44:20- Modifying 5  files in l/
     2022-01-03 06:45:02- Modifying 3  files in xl/
     2022-01-03 06:45:53- Modifying 3  files in xxl/
     2022-01-03 06:49:25- Adding 6050  files to xs/
     2022-01-03 06:49:25- Adding 1210  files to s/
     2022-01-03 06:49:25- Adding 121  files to m/
     2022-01-03 06:49:25- Adding 6  files to l/
     2022-01-03 06:49:31- Adding 3  files to xl/
     2022-01-03 06:49:43- Adding 3  files to xxl/
    
  9. Create archive No. 2 on HDD (with default compression)

     2022-01-03 06:51:42- Starting HDD Benchmark No. 02
     ------------------------------------------------------------------------------
     Archive name: benchmark02
     Archive fingerprint: 0beae8b556391fdca594809528ce4643524c83ba5ee9fd23e85511ab113b5601
     Time (start): Mon, 2022-01-03 06:51:43
     Time (end):   Mon, 2022-01-03 07:00:14
     Duration: 8 minutes 31.42 seconds
     Number of files: 73925
     Utilization of max. archive size: 0%
     ------------------------------------------------------------------------------
                            Original size      Compressed size    Deduplicated size
     This archive:              112.50 GB             77.39 GB             21.69 GB
     All archives:              278.02 GB            172.44 GB             77.25 GB
    
                            Unique chunks         Total chunks
     Chunk index:                   72346               274045
     ------------------------------------------------------------------------------
    
     real	8m36.079s
     user	1m54.660s
     sys	0m55.087s
    
  10. Create archive No. 2 on LTO (with no compression)

    2022-01-03 07:00:18- Starting LTO Benchmark No. 02
    ------------------------------------------------------------------------------
    Archive name: benchmark02
    Archive fingerprint: 53040e155dbf53ea1f8db6f72cf654df27893bf7d26425f65d019f10f54c8b19
    Time (start): Mon, 2022-01-03 07:03:25
    Time (end):   Mon, 2022-01-03 07:09:30
    Duration: 6 minutes 5.06 seconds
    Number of files: 73925
    Utilization of max. archive size: 0%
    ------------------------------------------------------------------------------
                           Original size      Compressed size    Deduplicated size
    This archive:              112.50 GB            112.50 GB             21.61 GB
    All archives:              278.02 GB            278.02 GB             77.53 GB
    
                           Unique chunks         Total chunks
    Chunk index:                   72418               274267
    ------------------------------------------------------------------------------
    
    real	26m28.837s
    user	1m28.260s
    sys	0m45.641s
    
  11. Modify 10% of all files and add 10% of each file type.

    2022-01-03 07:26:47- Modifying 6050  files in xs/
    2022-01-03 07:28:23- Modifying 1210  files in s/
    2022-01-03 07:28:55- Modifying 121  files in m/
    2022-01-03 07:29:12- Modifying 6  files in l/
    2022-01-03 07:29:50- Modifying 3  files in xl/
    2022-01-03 07:30:35- Modifying 3  files in xxl/
    2022-01-03 07:32:33- Adding 6655  files to xs/
    2022-01-03 07:32:33- Adding 1331  files to s/
    2022-01-03 07:32:34- Adding 133  files to m/
    2022-01-03 07:32:34- Adding 7  files to l/
    2022-01-03 07:32:40- Adding 4  files to xl/
    2022-01-03 07:32:56- Adding 4  files to xxl/
    
  12. Create archive No. 3 on HDD (with default compression)

    2022-01-03 07:33:44- Starting HDD Benchmark No. 03
    ------------------------------------------------------------------------------
    Archive name: benchmark03
    Archive fingerprint: b05c61b4917a84d1360916e094346c63cfa8b65efbcba83f44f99c2ae967702c
    Time (start): Mon, 2022-01-03 07:33:46
    Time (end):   Mon, 2022-01-03 07:40:20
    Duration: 6 minutes 34.44 seconds
    Number of files: 81324
    Utilization of max. archive size: 0%
    ------------------------------------------------------------------------------
                           Original size      Compressed size    Deduplicated size
    This archive:              126.44 GB             91.38 GB             13.99 GB
    All archives:              404.46 GB            263.81 GB             91.24 GB
    
                           Unique chunks         Total chunks
    Chunk index:                   84897               391901
    ------------------------------------------------------------------------------
    
    real	6m37.497s
    user	1m30.577s
    sys	0m39.766s
    
  13. Create archive No. 2 on LTO (with no compression)

    2022-01-03 07:40:22- Starting LTO Benchmark No. 03
    2022-01-03 10:36:59- Keyboard interrupt
    

Test hardware

Motherboard    M11SDV-8C+-LN4F  
Processor      AMD EPYC 3251 8c/16t 55W  
RAM            x2 16GB 2133 Mbps  DDR4 (SKU: M393A2G40EB1-CPB)  
Source HDD     SMR drive (SKU: ST8000DM004)  
Borg Repo HDD  SMR drive (SKU: WWD20EZRZ)  
Tape Drive     Quantum Ultrium 5 (SKU:TC-L52AN-BR)   
SAS Card       LSI SAS2008  
Tape Media     Quantum LTO5 Tape (SKU: MR-L5MQN-01)
  
* both HDDs idle and attached via onboard SATA Controller  

Hardware encryption and compression enabled on LTO drive.

borg version 1.1.9
LTFS version 2.4.0.2  
stenc v1.0.8

royalmoose avatar Jan 03 '22 12:01 royalmoose

@royalmoose thanks for doing these measurements! when you had to interrupt because it was taking so long, did you notice lots of random access to the tape (frequent rewind and fast forward ops)?

ThomasWaldmann avatar Jan 03 '22 21:01 ThomasWaldmann

Yep, the drive was constantly active throughout the three hours.
Querying the archive, data has been written to the tape but it is glacially slow at reading the repo. Took ~22min to finish an info command:

	time borg info /ltfs_benchmark/lto/repo::benchmark03
	 
	Archive name: benchmark03
	Archive fingerprint: 766178876e270bf7962a31d687f085c12dbf1972c0d95d71481558dfeffa1228
	Comment:
	Hostname: d5856e78b39c
	Username: root
	Time (start): Mon, 2022-01-03 07:40:34
	Time (end): Mon, 2022-01-03 07:45:38
	Duration: 5 minutes 4.42 seconds
	Number of files: 81324
	Command line: /usr/bin/borg create -s --compression none /ltfs_benchmark/lto/repo::benchmark03 /ltfs_benchmark/smr/
	Utilization of maximum supported archive size: 0%
	------------------------------------------------------------------------------
	                       Original size      Compressed size    Deduplicated size
	This archive:              126.42 GB            126.42 GB             13.94 GB
	All archives:              404.46 GB            404.46 GB             91.47 GB
	
	                       Unique chunks         Total chunks
	Chunk index:                   84842               392066
	
	real    21m59.831s
	user    0m0.385s
	sys     0m0.073s

royalmoose avatar Jan 05 '22 10:01 royalmoose

Guess because borg is not designed / optimized for sequential access it is just too slow for LTFS and similar stuff.

Maybe creating and extracting archives could somehow work ok, but compacting and some other stuff are rather random access.

ThomasWaldmann avatar Jan 05 '22 13:01 ThomasWaldmann