{"id":18717111,"url":"https://github.com/nicerath/python3-tape-backup","last_synced_at":"2025-11-10T12:30:16.052Z","repository":{"id":234182654,"uuid":"788401420","full_name":"NiceRath/python3-tape-backup","owner":"NiceRath","description":"Python3 Script to backup directories to Tape using tar \u0026 mtx","archived":false,"fork":false,"pushed_at":"2024-12-04T10:27:28.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T10:36:20.559Z","etag":null,"topics":["backup","mt","mtx","restore","tape","tape-archive","tape-backup","tape-library","tar"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NiceRath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-18T10:48:48.000Z","updated_at":"2024-12-04T10:27:32.000Z","dependencies_parsed_at":"2024-05-06T02:15:10.556Z","dependency_job_id":null,"html_url":"https://github.com/NiceRath/python3-tape-backup","commit_stats":null,"previous_names":["nicerath/python3-tape-backup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiceRath%2Fpython3-tape-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiceRath%2Fpython3-tape-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiceRath%2Fpython3-tape-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiceRath%2Fpython3-tape-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NiceRath","download_url":"https://codeload.github.com/NiceRath/python3-tape-backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239581796,"owners_count":19662958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","mt","mtx","restore","tape","tape-archive","tape-backup","tape-library","tar"],"created_at":"2024-11-07T13:14:59.656Z","updated_at":"2025-11-10T12:30:15.999Z","avatar_url":"https://github.com/NiceRath.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python3 - Tape Backup Script\n\nThis is a generic Python3 script that is able to back-up directories to tapes/tape-libraries using [tar](https://linux.die.net/man/1/tar) \u0026 [mtx](https://linux.die.net/man/1/mtx).\n\nTested with [Dell PowerVault TL1000](https://www.dell.com/en-us/shop/data-storage-and-backup/powervault-tl1000/spd/storage-tl1000/pw_tl1000_11595).\n\nIt is meant to be lightweight.\n\nA status e-mail with some stats is sent once the backup is finished.\n\nYou can test it by setting `TRY_RUN` to `True`. This will create snapshots and move cartridges inside the tape library - but skip the actual backup.\n\nThe first file on the tape is a **tape-content-index** that can be used when restoring data!\n\nIf there are many small files - the throughput will be low. With larger files we've seen 150-300MB/s with TLO7 (uncompressed).\n\n```text\nBackup job stati:\n\nBackup start time: 2024-02-06 18:00:00\nBackup finish time: 2024-02-08 03:06:53\n\nChange the listed tapes and mark them with the folder-lists!!\n\n...\n\nBackup status for tape in slot '5' with label 'D0018M8':\n\nStart time: 2024-02-08 01:03:12\nStop time: 2024-02-08 03:05:40\nExit code: 0\nFolder 'archive' size: 10 MB\nFolder 'app1' size: 271 MB\nFolder 'app2' size: 307 MB\nFolder 'app3' size: 358.06 GB\nFolder 'app4' size: 84.67 GB\n...\n\nFull size: 0.428 TB\nCalculated throughput: 61.02 MB/s\n\n...\n```\n\n----\n\n## Restore\n\nWarning: Tape restores can take a long time.\n\nMake sure no Tape-Backup-Job is started while restoring data!\n\n### Prerequisites\n\nLoad tape to restore from.\n\n### Get active SG-device\n\n```bash\nls /dev/ | grep sg[0-9]\nmtx -f /dev/sgN status 2\u003e /dev/null  # correct one displays the current inventory\n```\n\nUpdate the `/dev/sg0` references in the other commands.\n\n### Check what tape to load\n\n```bash\nmtx -f /dev/sg0 inventory\nmtx -f /dev/sg0 status\n```\n\n### Load tape\n\n```bash\nmtx -f /dev/sg0 load \u003cID\u003e\n```\n\n### Find data to restore\n\n#### Check the local tape-content index-file\n\n```bash\nls -l ${BACKUP_PATH}/tape_content_index/\nless ${BACKUP_PATH}/tape_content_index/tape_content_index_${DATETIME}.txt\n```\n\n#### OR Check the tape-content index-file\n\n```bash\nRESTORE_PATH=\"${BACKUP_PATH}/restore\"\nmkdir \"$RESTORE_PATH\"\ntar -xvf /dev/st0 -C \"$RESTORE_PATH\" --blocking-factor 2048 \"tmp/tape_content_index.txt\"\n# press CTRL+C after a few seconds\nmt -f /dev/sg0 rewind\nless \"${BACKUP_PATH}/restore/tmp/tape_content_index.txt\"\n```\n\n#### OR read the full tape content (VERY SLOW)\n\n```bash\ntar -tvf /dev/sg0 --blocking-factor 2048 | tee -a tape_content.log\nmt -f /dev/sg0 rewind\n```\n\n### Restore\n\n```bash\nRESTORE_PATH=\"${BACKUP_PATH}/restore\"\nTO_RESTORE='\u003cPATH-TO-FILE-OR-DIR\u003e'  # find in tape-content-index\n\nmkdir \"$RESTORE_PATH\"\ntar -xvf /dev/sg0 -C \"$RESTORE_PATH\" --blocking-factor 2048 \"$TO_RESTORE\" \u003e\u003e /var/log/backup/tape_restore.log 2\u003e\u00261 \u0026\n\n# put the restore process into the background (session independent)\njobs\ndisown\n\n# check if process is still running\nps -aux | grep tar\n```\n\n### Unload tape\n\n```bash\nmt -f /dev/st0 rewind\nmtx -f /dev/sg0 unload\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicerath%2Fpython3-tape-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicerath%2Fpython3-tape-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicerath%2Fpython3-tape-backup/lists"}