{"id":20667100,"url":"https://github.com/thechymera/mkstage4","last_synced_at":"2025-04-19T17:07:55.224Z","repository":{"id":17136370,"uuid":"19902816","full_name":"TheChymera/mkstage4","owner":"TheChymera","description":"Bash Utility for Creating Stage 4 Tarballs  ","archived":false,"fork":false,"pushed_at":"2024-03-25T23:15:22.000Z","size":96,"stargazers_count":111,"open_issues_count":6,"forks_count":22,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T10:41:45.608Z","etag":null,"topics":["archiving","backup","gentoo","linux","stage4","system-management"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheChymera.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":"2014-05-18T04:28:54.000Z","updated_at":"2025-01-16T14:26:26.000Z","dependencies_parsed_at":"2024-11-27T10:40:47.397Z","dependency_job_id":null,"html_url":"https://github.com/TheChymera/mkstage4","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheChymera%2Fmkstage4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheChymera%2Fmkstage4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheChymera%2Fmkstage4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheChymera%2Fmkstage4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheChymera","download_url":"https://codeload.github.com/TheChymera/mkstage4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249745853,"owners_count":21319581,"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":["archiving","backup","gentoo","linux","stage4","system-management"],"created_at":"2024-11-16T19:42:54.381Z","updated_at":"2025-04-19T17:07:55.206Z","avatar_url":"https://github.com/TheChymera.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mkstage4\n\n![CI](https://github.com/TheChymera/mkstage4/workflows/CI/badge.svg)\n[![GitHub release](https://img.shields.io/github/release/TheChymera/mkstage4.svg)](https://GitHub.com/TheChymera/mkstage4/releases/)\n[![Gentoo package](https://repology.org/badge/version-for-repo/gentoo/mkstage4.svg?header=Gentoo)](https://repology.org/project/mkstage4/versions)\n[![LiGurOS package](https://repology.org/badge/version-for-repo/liguros_stable/mkstage4.svg?header=LiGurOS)](https://repology.org/project/mkstage4/versions)\n\nThis is a Bash script which creates “stage 4” tarballs (i.e. system archives) either for the running system, or a system at a specified mount point.\nThe script was inspired by an earlier [mkstage4 script](https://github.com/gregf/bin/blob/master/mkstage4) by Greg Fitzgerald (unmaintained as of 2012) which itself was a revamped edition of the [original mkstage4](http://blinkeye.ch/dokuwiki/doku.php/projects/mkstage4) by Reto Glauser (unmaintained as of 2009).\n\n## Installation\n\nThe script can be run directly from its containing folder (and thus, is installed simply by downloading or cloning it from here - and adding run permissions):\n\n```bash\ngit clone https://github.com/TheChymera/mkstage4.git /your/mkstage4/directory\ncd /your/mkstage4/directory\nchmod +x cpstage4.sh exstage4.sh mkstage4.sh\n```\n\nFor [Gentoo Linux](http://en.wikipedia.org/wiki/Gentoo_linux) and [Derivatives](http://en.wikipedia.org/wiki/Category:Gentoo_Linux_derivatives), mkstage4 is also available in [Portage](http://en.wikipedia.org/wiki/Portage_(software)) via the base Gentoo overlay.\nOn any Gentoo system, just run the following command:\n\n```bash\nemerge app-backup/mkstage4\n```\n\n## Usage\n\n*If you are running the script from the containing folder (first install method) please make sure you use the e.g. `./mkstage4.sh` command instead of just `mkstage4`!*\n\nNote that the extension (e.g. `.tar.xz`) will be automatically appended to the `archive_name` string which you specify in calling the `mkstage4` command.\nThis is done based on the compression type, which can be specifiled via the `-C` parameter, if another compression than the default (`bz2`, creating files ending in `.tar.bz2`) is desired.\n\n### Examples\n\nArchive your current system (mounted at /):\n\n```bash\nmkstage4 -s archive_name\n```\n\nArchive a system located at a custom mount point:\n\n```bash\nmkstage4 -t /custom/mount/point archive_name\n```\n\nCopy a system to a separate drive, e.g. for quick backup.\n\n```bash\ncpstage4 / /run/media/myuser/mybackupdrive\n```\n\n### Command line arguments\n\n```console\nUsage:\n\tmkstage4.sh [-b -c -k -l -q] [-C \u003ccompression-type\u003e] [-s || -t \u003ctarget-mountpoint\u003e] [-e \u003cadditional excludes dir*\u003e] [-i \u003cadditional include target\u003e] \u003carchive-filename\u003e [custom-tar-options]\n\t-b: excludes boot directory.\n\t-c: excludes some confidential files (currently only .bash_history and connman network lists).\n\t-k: separately save current kernel modules and src (creates smaller archives and saves decompression time).\n\t-l: excludes lost+found directory.\n\t-q: activates quiet mode (no confirmation).\n\t-C: specify tar compression (default: bz2, available: lz4 xz bz2 zst gz).\n\t-s: makes tarball of current system.\n\t-t: makes tarball of system located at the \u003ctarget-mountpoint\u003e.\n\t-e: an additional excludes directory (one dir one -e, donot use it with *).\n\t-i: an additional target to include. This has higher precedence than -e, -t, and -s.\n\t-h: displays help message.\n```\n\n## System Tarball Extraction\n\n### Automatic (Multi-threaded)\n\nWe provide a script for convenient extraction, `exstage4`, which is shipped with this package.\nCurrently it simply automates the Multi-threaded extraction selection listed below and otherwise has no functionality except checking that the file name looks sane.\nIf in doubt, use one of the explicit extraction methods described below.\nOtherwise, you can extract an archive inplace with:\n\n```bash\nexstage4 archive_name.tar.bz2\n```\n\n### Explicit Single-threaded\n\nTarballs created with mkstage4 can be extracted with:\n\nTo preserve binary attributes and use numeric owner identifiers, you can simply append the relevant flags to the respective `tar` commands, e.g.:\n\n```bash\ntar xvjpf archive_name.tar.bz2 --xattrs-include='*.*' --numeric-owner\n```\n\nIf you use the `-k` option, extract the `src` and modules archives separately:\n\n```bash\ntar xvjpf archive_name.tar.bz2.kmod\ntar xvjpf archive_name.tar.bz2.ksrc\n```\n\n### Explicit Multi-threaded\n\nIf you have a parallel de/compressor installed, you can extract the archive with one of the respective commands:\n\n#### `pbzip2`\n\n```bash\ntar -I pbzip2 -xvf archive_name.tar.bz2 --xattrs-include='*.*' --numeric-owner\n```\n\n#### `xz`\n\n```bash\ntar -I 'xz -T0' -xvf archive_name.tar.xz --xattrs-include='*.*' --numeric-owner\n```\n\n#### `gzip`\n\nSimilarly to other compressors, `gzip` uses a separate binary for parallel decompression:\n\n```bash\ntar -I unpigz -xvf archive_name.tar.gz --xattrs-include='*.*' --numeric-owner\n```\n\n## Dependencies\n\n*Please note that these are very basic dependencies and should already be included in any Linux system.*\n\n* **[Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell))** - in [Portage](http://en.wikipedia.org/wiki/Portage_(software)) as **[app-shells/bash](https://packages.gentoo.org/packages/app-shells/bash)**\n* **[tar](https://en.wikipedia.org/wiki/Tar_(computing))** - in Portage as **[app-arch/tar](https://packages.gentoo.org/packages/app-arch/tar)**\n* **[bzip2](https://gitlab.com/federicomenaquintero/bzip2)** - in Portage as **[app-arch/bzip2](https://packages.gentoo.org/packages/app-arch/bzip2)** (single thread, default compression)\n\n\n**Optionals**:\n*If one the following is installed the archive will be compressed using multiple parallel threads when available, in order of succession:*\n\n* `-C xz`:\n  * **[xz](https://tukaani.org/xz/)** - in Portage as **[app-arch/xz](https://packages.gentoo.org/packages/app-arch/xz-utils)**, (parallel)\n  * **[pixz](https://github.com/vasi/pixz)** - in Portage as **[app-arch/pixz](https://packages.gentoo.org/packages/app-arch/pixz)**, (parallel, indexed)\n\n* `-C bz2`:\n  * **[pbzip2](https://launchpad.net/pbzip2/)** - in Portage as **[app-arch/pbzip2](https://packages.gentoo.org/packages/app-arch/pbzip2)**, (parallel)\n  * **[lbzip2](https://github.com/kjn/lbzip2/)** - in Portage as **[app-arch/lbzip2](https://packages.gentoo.org/packages/app-arch/lbzip2)**, (parallel, faster and more efficient)\n\n* `-C gz`:\n  * **[gzip](https://www.gnu.org/software/gzip/)** - in Portage as **[app-arch/gzip](https://packages.gentoo.org/packages/app-arch/gzip)**, (single thread)\n  * **[pigz](https://www.zlib.net/pigz/)** - in Portage as **[app-arch/pigz](https://packages.gentoo.org/packages/app-arch/pigz)**, (parallel)\n\n* `-C lrz`:\n  * **[lrzip](https://github.com/ckolivas/lrzip/)** - in Portage as **[app-arch/lrzip](https://packages.gentoo.org/packages/app-arch/lrzip)**, (parallel)\n\n* `-C lz`:\n  * **[lzip](https://www.nongnu.org/lzip/)** - in Portage as **[app-arch/lzip](https://packages.gentoo.org/packages/app-arch/lzip)**, (single thread)\n  * **[plzip](https://www.nongnu.org/lzip/plzip.html)** - in Portage as **[app-arch/plzip](https://packages.gentoo.org/packages/app-arch/plzip)**, (parallel)\n\n* `-C lz4`:\n  * **[lz4](https://github.com/lz4/lz4)** - in Portage as **[app-arch/lz4](https://packages.gentoo.org/packages/app-arch/lz4)**, (parallel)\n\n* `-C lzo`:\n  * **[lzop](https://www.lzop.org/)** - in Portage as **[app-arch/lzop](https://packages.gentoo.org/packages/app-arch/lzop)**, (parallel)\n\n* `-C zstd`:\n  * **[zstd](https://facebook.github.io/zstd/)** - in Portage as **[app-arch/zstd](https://packages.gentoo.org/packages/app-arch/zstd)**, (parallel)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthechymera%2Fmkstage4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthechymera%2Fmkstage4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthechymera%2Fmkstage4/lists"}