Coder Social home page Coder Social logo

mkstage4's Introduction

mkstage4

CI GitHub release Gentoo package LiGurOS package

This 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. The script was inspired by an earlier mkstage4 script by Greg Fitzgerald (unmaintained as of 2012) which itself was a revamped edition of the original mkstage4 by Reto Glauser (unmaintained as of 2009).

Installation

The 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):

git clone https://github.com/TheChymera/mkstage4.git /your/mkstage4/directory
cd /your/mkstage4/directory
chmod +x cpstage4.sh exstage4.sh mkstage4.sh

For Gentoo Linux and Derivatives, mkstage4 is also available in Portage via the base Gentoo overlay. On any Gentoo system, just run the following command:

emerge app-backup/mkstage4

Usage

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!

Note that the extension (e.g. .tar.xz) will be automatically appended to the archive_name string which you specify in calling the mkstage4 command. This 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.

Examples

Archive your current system (mounted at /):

mkstage4 -s archive_name

Archive a system located at a custom mount point:

mkstage4 -t /custom/mount/point archive_name

Copy a system to a separate drive, e.g. for quick backup.

cpstage4 / /run/media/myuser/mybackupdrive

Command line arguments

Usage:
	mkstage4.sh [-b -c -k -l -q] [-C <compression-type>] [-s || -t <target-mountpoint>] [-e <additional excludes dir*>] [-i <additional include target>] <archive-filename> [custom-tar-options]
	-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.

System Tarball Extraction

Automatic (Multi-threaded)

We provide a script for convenient extraction, exstage4, which is shipped with this package. Currently it simply automates the Multi-threaded extraction selection listed below and otherwise has no functionality except checking that the file name looks sane. If in doubt, use one of the explicit extraction methods described below. Otherwise, you can extract an archive inplace with:

exstage4 archive_name.tar.bz2

Explicit Single-threaded

Tarballs created with mkstage4 can be extracted with:

To preserve binary attributes and use numeric owner identifiers, you can simply append the relevant flags to the respective tar commands, e.g.:

tar xvjpf archive_name.tar.bz2 --xattrs-include='*.*' --numeric-owner

If you use the -k option, extract the src and modules archives separately:

tar xvjpf archive_name.tar.bz2.kmod
tar xvjpf archive_name.tar.bz2.ksrc

Explicit Multi-threaded

If you have a parallel de/compressor installed, you can extract the archive with one of the respective commands:

pbzip2

tar -I pbzip2 -xvf archive_name.tar.bz2 --xattrs-include='*.*' --numeric-owner

xz

tar -I 'xz -T0' -xvf archive_name.tar.xz --xattrs-include='*.*' --numeric-owner

gzip

Similarly to other compressors, gzip uses a separate binary for parallel decompression:

tar -I unpigz -xvf archive_name.tar.gz --xattrs-include='*.*' --numeric-owner

Dependencies

Please note that these are very basic dependencies and should already be included in any Linux system.

Optionals: If one the following is installed the archive will be compressed using multiple parallel threads when available, in order of succession:

mkstage4's People

Contributors

thechymera avatar lucianposton avatar liu-kan avatar brendanhoran avatar tatsh avatar mgomersbach avatar an9wer avatar tomslobodnik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.