mkstage4
mkstage4 is a Bash script to create stage 4 tarballs either for the running system, or for a system at a specified mount point.
Gentoo Stage 4 tarballs are used to provide the user with a fully built Gentoo system within a tarball, which can be installed similarly to a Stage 3 archive however with a greatly less amount of effort, time and steps.
Installation
To install mkstage4, the app-backup/mkstage4 package may need unmasking. This may not apply for all systems depending on prior-use and configuration.
To unmask, add the following to a file:
/etc/portage/package.accept_keywords/mkstage4
How to unmask the mkstage4 packageapp-backup/mkstage4
Emerge
Install with the following command:
root #
emerge --ask mkstage4
Usage
To produce a Stage 4 archive of the current system using mkstage4:
root #
mkstage4 -s <name>
This will create a Stage 4 archive of all files under / (current root partition). Similarly, to specify a different location to make a Stage 4 archive of:
root #
mkstage4 -t /custom/mount/point <name>
If using a smaller storage device, or just wish to not fill up internal storage, specify writing the Stage 4 tarball to a different partition/drive using:
root #
cd <destination directory>
root #
mkstage4 -s <name>
This will write the Stage 4 archive to the destination directory.
Invocation
user $
mkstage4 --help
Usage: -b: excludes boot directory. -c: excludes some confidential files (currently only .bash_history and connman network lists). -k: separately save current kernel modules and src (creates smaller archives and saves decompression time). -l: excludes lost+found directory. -q: activates quiet mode (no confirmation). -C: specify tar compression (default: bz2, available: lz4 xz bz2 zst gz). -s: makes tarball of current system. -t: makes tarball of system located at the <target-mountpoint>. -e: an additional excludes directory (one dir one -e, donot use it with *). -i: an additional target to include. This has higher precedence than -e, -t, and -s. -h: displays help message.
See also
- Stage tarball — an archive of the basic files and packages used for the installation of Gentoo Linux.
External references
- GitHub repository - For more information on advanced and further use of mkstage4
- Stage 4 Tarballs Made Easy - blog post on usage