Giter Club home page Giter Club logo

system-tar-and-restore's Introduction

System Tar & Restore

Backup

ABOUT

System tar & restore contains two bash scripts, the main program star.sh and a gui wrapper star-gui.sh.
Three modes are available: Backup, Restore and Transfer.

Supported distributions: Arch, Debian/Ubuntu, Fedora, openSUSE, Gentoo, Mandriva/Mageia

Stable Releases

DISTRIBUTION PACKAGES

Archlinux
See the wiki page.

Gentoo
The package is provided by the gentoo-el overlay. You can install it with the following commands as root. (you need to have layman installed and configured)

layman -a gentoo-el  
emerge app-backup/system-tar-and-restore

REQUIREMENTS

  • gtkdialog 0.8.3 or later (for the gui)
  • tar 1.27 or later (acls and xattrs support)
  • rsync (for Transfer Mode)
  • wget (for downloading backup archives)
  • gptfdisk/gdisk (for GPT and Syslinux)
  • openssl/gpg (for encryption)

THINGS YOU CAN DO

  • Full system or partial backup
  • Restore or transfer to the same or different disk/partition layout.
  • Restore or transfer to an external device such as usb flash drive, sd card etc.
  • Restore a BIOS-based system to UEFI and vice versa.
  • Prepare a system in a virtual machine (such as virtualbox), back it up and restore it in a normal machine.

BACKUP MODE

With this mode you can make a tar backup archive of your system. You can define:

  • Archive filename: A desired name for the backup archive. Default is Backup-$(hostname)-$(date +%Y%m%d-%H%M%S).
  • Destination directory: Set where you want to save the backup archive. Default is /.
  • Home directory: You have three options: fully include it, keep only it's hidden files and folders (which are necessary to login and keep basic settings) or completely exclude it (in case it's located in separate partition and you want to use that in restore mode).
  • Compression: You can choose between gzip, bzip2, xz and none (for no compression). Gzip should be fine.
  • Encryption method and passphrase: Select encryption method (openssl or gpg) and enter a passphrase if you want to encrypt the archive.
  • Archiver options: You can pass your own extra options in the archiver. See tar --help for more info.

The script can read input from /etc/backup.conf. Alternative path can be specified: star.sh /path/backup.conf -i 0 or star-gui.sh /path/backup.conf. See the provided sample or use -g, --generate to generate a configuration file.

When the process completes, you may want to check backup.log file in the same directory with the backup archive.

RESTORE/TRANSFER MODE

Restore mode uses the above created archive to extract it in desired partition(s). Transfer mode transfers your system in desired partition(s) using rsync. Then, in both cases, the script generates the target system's fstab, rebuilds initramfs for every available kernel, generates locales and finally installs and configures the selected bootloader.

Boot from a livecd - preferably one of the target (backed up) distro - or another existing system, prepare your target partition(s) and start the script. You can define:

  • Target partitions: You must specify a target root partition. Optionally you can choose any other partition for your /home, /boot, swap or custom mount points (/var /opt etc.) and in case of UEFI a target ESP partition and it's mount point (/boot/efi or /boot).
  • Mount options: You can specify alternative comma-seperated mount options for the target root partition. Defaults are defaults,noatime.
  • Btrfs subvolumes: If the target root filesystem is Btrfs, you can create subvolumes. Set the root subvolume name and also you can specify other subvolumes. Just enter the paths (/home /var /usr etc.) seperated by space. Recommended root subvolume name is __active.
  • Bootloader: In BIOS systems you can choose Grub (version 2) or Syslinux and the target device. If you select a raid array as bootloader device, the script will install the bootloader in all devices that the array contains. In case of UEFI you can choose Grub, EFISTUB/efibootmgr or Systemd/bootctl. Also you can define additional kernel options.
  • Modes: In Restore mode you have to specify the backup archive (local path or remote url). If the archive is encrypted you must specify the passphrase. In Transfer mode you can choose if you want to transfer your entire /home directory, only it's hidden files and folders (which are necessary to login and keep basic settings) or exclude it.
  • Tar/Rsync options: You may want to specify any additional options. See tar --help or rsync --help for more info.

When the process completes check /tmp/restore.log.

See star.sh --help for all available options.

NOTES

  • In case of Gentoo initramfs is optional. You can use -D, --use-genkernel in Restore/Transfer mode to enable initramfs building via genkernel.

  • In the target system, the script saves configuration files before generate/modify them with -old suffix.

  • In case of UEFI, you must boot in UEFI enviroment to restore a system. The script will check if /sys/firmware/efi exists and act accordingly. You must create an EFI System Partition.

  • Some tested Restore/Transfer scenarios are included in the table below.

Tested scenarios
TARGET PARTITION MOUNTPOINT BOOTLOADER SYSTEM NOTES
/dev/sdX1 / Grub
Syslinux
BIOS MBR
/dev/sdX2
/dev/sdX1
/dev/sdX3
/dev/sdX4
/
/boot
/home
/var
Grub
Syslinux
BIOS MBR
/dev/md0 / Grub
Syslinux
BIOS MBR level=1
metadata=1.0
/dev/md1
/dev/md0*
/
/boot
Syslinux BIOS GPT level=1
metadata=1.0*
/dev/sdX2
/dev/sdX1
/
/boot
Grub
Syslinux
BIOS MBR btrfs
Root Subvolume: __active
Other Subvolumes: /home /usr /var /opt
/dev/mapper/A-B
/dev/sdX1*
/dev/sdX3
/

/boot
Grub
Syslinux
BIOS GPT lvm
Grub needs BIOS Boot Partition*
/dev/mapper/A-B
/dev/sdX1
/dev/mapper/A-C
/dev/mapper/A-D
/dev/mapper/X
/
/boot
/home
swap

Grub
Syslinux
BIOS MBR lvm on luks
/dev/mapper/A-B
/dev/md1
/dev/md0*
/

/boot
Syslinux BIOS GPT lvm on mdadm
level=1
metadata=1.0*
/dev/mapper/A-B
/dev/mapper/X
/dev/md1
/dev/md0*
/


/boot
Syslinux BIOS GPT lvm on luks on mdadm
level=1
metadata=1.0*
/dev/mapper/X
/dev/sdX1
/
/boot
Grub
Syslinux
BIOS MBR luks
/dev/mapper/X
/dev/A/B
/dev/sdX1
/

/boot
Grub
Syslinux
BIOS MBR luks on lvm
/dev/mapper/X
/dev/md1
/dev/md0*
/

/boot
Syslinux BIOS GPT luks on mdadm
level=1
metadata=1.0*
/dev/mapper/X
/dev/mapper/A-B
/dev/md1
/dev/md0*
/


/boot
Syslinux BIOS GPT luks on lvm on mdadm
level=1
metadata=1.0*
/dev/sdX2
/dev/sdX1*
/
/boot/efi
Grub
EFISTUB/efibootmgr
Systemd/bootctl
UEFI GPT ESP*
efibootmgr 0.12
efivar 0.21
systemd >= 222
/dev/sdX2
/dev/sdX1*
/
/boot
Grub
EFISTUB/efibootmgr
Systemd/bootctl
UEFI GPT ESP*
efibootmgr 0.12
efivar 0.21
systemd >= 222
/dev/mapper/X
/dev/sdX2
/dev/sdX1*
/
/boot
/boot/efi
Grub
EFISTUB/efibootmgr
Systemd/bootctl
UEFI GPT luks
ESP*
efibootmgr 0.12
efivar 0.21
systemd >= 222

EXAMPLES USING ARGUMENTS

Backup Mode:

  • Destination: /home/john/
  • Compression: gzip
  • Additional options: --exclude=/home/john/.cache/* --warning=none

star.sh -i 0 -d /home/john/ -c gzip -u "--exclude=/home/john/.cache/* --warning=none"

  • Destination: /home/john/
  • Compression: xz
  • Exclude /home directory

star.sh -i 0 -d /home/john/ -c xz -H 2

  • Destination: /home/john/
  • Compression: bzip2
  • Keep only /home's hidden files and folders
  • Encryption

star.sh -i 0 -d /home/john/ -c bzip2 -E openssl -P 1234 -H 1

Restore Mode:

  • root: /dev/sdb1
  • grub
  • local archive

star.sh -i 1 -r /dev/sdb1 -G /dev/sdb -f /home/john/backup.tar.gz

  • root: /dev/sdb1, /home: /dev/sdb2, swap: /dev/sdb3
  • syslinux
  • remote archive on ftp server

star.sh -i 1 -r /dev/sdb1 -h /dev/sdb2 -s /dev/sdb3 -S /dev/sdb -f ftp://server/backup.tar.xz

  • root: /dev/md1, /boot: /dev/md0
  • local archive
  • syslinux

star.sh -i 1 -r /dev/md1 -b /dev/md0 -f /home/john/backup.tar.gz -S /dev/md0

  • root: /dev/sdb1
  • syslinux
  • remote file in protected http server

star.sh -i 1 -r /dev/sdb1 -S /dev/sdb -f http://server/backup.tar.gz -y username -p password

  • root: /dev/sda2, esp: /dev/sda1
  • local archive
  • grub

star.sh -i 1 -r /dev/sda2 -e /dev/sda1 -l /boot/efi -G auto -f /home/john/backup.tar.gz

Transfer Mode:

  • root: /dev/sda1 (ssd)
  • syslinux
  • kernel options: nomodeset

star.sh -i 2 -r /dev/sda1 -m discard,errors=remount-ro -S /dev/sda -k nomodeset

  • root: /dev/mapper/debian-root, /boot: /dev/sdb1
  • grub

star.sh -i 2 -r /dev/mapper/debian-root -b /dev/sdb1 -G /dev/sdb

  • root: /dev/sda2 (btrfs with compression), /boot: /dev/sda1
  • root subvolume: __active
  • /var, /usr and /home subvolumes
  • syslinux

star.sh -i 2 -r /dev/sda2 -m compress=lzo -b /dev/sda1 -S /dev/sda -R __active -B "/var /usr /home"

  • root: /dev/sdb2, /boot: /dev/sdb1, /var: /dev/sdb4, /usr: /dev/sdb3
  • transfer /home's hidden files and folders only
  • grub

star.sh -i 2 -r /dev/sdb2 -b /dev/sdb1 -t "/var=/dev/sdb4 /usr=/dev/sdb3" -G /dev/sdb -H 1

system-tar-and-restore's People

Contributors

0rinsb3lt avatar dajkazsolt avatar pmav99 avatar tritonas00 avatar warlock90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

system-tar-and-restore's Issues

Parallel Decompression

Noticed that on restoring a system that there was a significant amount of time checking the archive
and wondered if it could be quicker with parallel decompression. I know that pbzip2 has it.

tar supports a -I option to use other programs such as pbzip2

  • tar -I pbzip2

possibly just reuse the -M --multi-core option for defining decompression (Restore mode).

Error: Running and target system architecture mismatch or invalid archive

Hi tritonas00,
thank you for this app its a nice piece of work.
I cannot see wether its an issue or maybe i'm missing something:

I'm trying to restore Arch Linux to a singled partitioned USB flash ext4. Before that all data, filesystem and signatures were wiped off the stick and then i partitioned it with parted to ext4 (without journal: mkfs.ext4 -O "^has_journal" /dev/sdXX).
Tried to restore (not transfer mode) from a btrfs and afterwards from a ext4 (out of virtualbox) running system. Tried two different backup archives and two different flash drives, with or without bootloader installation.
Here's the config file of the backup:

Auto-generated configuration file for backup mode. Place it in /etc
BRFOLDER="/run/media/kinoe/SPEICHER/BACKUPS"
BRNAME="Backup-limiarchie-20180604"
BRcompression="gzip"
BRnocolor="Yes"
BRquiet="Yes"
BRmcore="Yes"
BRthreads="2"
BRsrc="/run/media/kinoe/ARCHIE"

Do i have to place it in /etc before restoring? I didn't

Here the backup log:

[SUMMARY]
ARCHIVE
/run/media/kinoe/SPEICHER/BACKUPS/Backup-2018-06-04/Backup-limiarchie-20180604.tar.gz (/run/media/kinoe/ARCHIE) (pigz 2 threads)
ARCHIVER OPTIONS
--exclude=Backup-2018-06-04
[ARCHIVER]
tar: ARCHIE/var/lib/samba/private/msg.sock/383: Socket ignoriert
tar: ARCHIE/var/lib/samba/private/msg.sock/391: Socket ignoriert
tar: ARCHIE/var/lib/samba/private/msg.sock/390: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox-alt-1/.dropbox/iface_socket: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox-alt-1/.dropbox/command_socket: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox.old/iface_socket: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox.old/command_socket: Socket ignoriert
tar: ARCHIE/home/limi/.config/deadbeef/socket: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox/iface_socket: Socket ignoriert
tar: ARCHIE/home/limi/.dropbox/command_socket: Socket ignoriert
829913 Files archived successfully
Elapsed time: 0 hours 17 min 38 sec

system-tar-and-restore failed on rhel5 and rhel6?

I know system-tar-and-restore Supported distributions: Arch, Debian/Ubuntu, Fedora, openSUSE, Gentoo, Mandriva/Mageia,

I want to backup a rhel5-x86-64 server, system-tar-and-restore found that bootloaders is Syslinux, but real bootloader is Grub Legacy0.97.
I could backup the rhel5-x86-64 server in "CLI" mode, but when i restore, system-tar-and-restore failed, seems like system-tar-and-restore couldn't found the real bootloader.

then how can i do?

An error occurred.

Hello!
I try to backup system with this command:

./star.sh -i 0 -d /backup/ -c gzip -q -u "--same-permissions --same-owner --exclude=/backup/* --warning=none"

And get error at the end:

root@border1:~# ./star.sh -i 0 -d /backup/ -c gzip -q -u "--same-permissions --same-owner --exclude=/backup/* --warning=none"
System Tar & Restore 7.0
[SUMMARY]
ARCHIVE
/backup/Backup-2019-10-31/Backup-border1-20191031-163856.tar.gz (/)

ARCHIVER OPTIONS
--same-permissions
--same-owner
--exclude=/backup/*
--warning=none
--sparse
--acls
--xattrs
--exclude=/run/*
--exclude=/dev/*
--exclude=/sys/*
--exclude=/tmp/*
--exclude=/mnt/*
--exclude=/proc/*
--exclude=/media/*
--exclude=/var/run/*
--exclude=/var/lock/*
--exclude=.gvfs
--exclude=lost+found
--exclude=Backup-2019-10-31

HOME DIRECTORY
Include

FOUND BOOTLOADERS
Grub
Systemd/bootctl

[PROCESSING]
Calculating: 49521 Files
Archiving: [========================] 100%
Setting permissions to /backup/Backup-2019-10-31

An error occurred.

Check /backup/Backup-2019-10-31/backup.log for details.
Elapsed time: 0 hours 4 min 57 sec

I don't copy backup.conf, so I expect default values are used.

Log file contains extra ARCHIVE block, other part is same as log above:

[ARCHIVER]
tar: removing leading /' from member names tar: removing leading /' from hard link targets
Elapsed time: 0 hours 4 min 57 sec

Backup folder view:

root@border1:~# ls /backup/Backup-2019-10-31/ -lah
итого 991M
drwxrwxrwx 2 root root 4,0K окт 31 16:45 .
drwxr-xr-x 3 root root 4,0K окт 31 16:38 ..
-rw-rw-rw- 1 root root 991M окт 31 16:43 Backup-border1-20191031-163856.tar.gz
-rw-rw-rw- 1 root root 733 окт 31 16:43 backup.log

When I try to unpack archive I got this error and operation aborted:
Ignoring malformed pax extended attribute

What can be wrong ? Please, help!

a little UPD:
Ignoring malformed pax extended attribute appears with gui archiver in ubuntu.
tar -xzf Backup-border1-20191031-163856.tar.gz untar file without errors

Ubuntu 16.04: GUI wrapper can't find functions

OS: Ubuntu 16.04.1 Arch: Amd64 gtkdialog: 0.8.3

Gtkdialog windows can't call functions exported by star-gui.sh (scan_disks hide_used_parts set_default_pass set_default_opts set_default_multi set_args status_bar run_main).

One solution, as reported by the developer of multisystem (https://forum.ubuntu-fr.org/viewtopic.php?id=1987488), consists in putting functions in a separate script that can be sourced by gtkdialog at every function call. This does work.

This problem seems related specifically to Ubuntu 16.04. As I am not a shell expert, I have no clue about where it steams from.

Tips & Tricks : How to extent "Additional Options" and "Exclude" permanently?

I am looking for a way to add additional excludes to the existing list. I tried to edit both /etc/conf.d/system-tar-and-restore.conf and /usr/share/system-tar-and-restore/backup.example.conf but whem I try to actually compress a tar, backup.log doesn't have my options.

Of course one can always extend the defaults from the proper fields but if frequent backups have to be taken, or the exclude-list is big, it's much more convinient to "store" the program's preferences.

Either I installed the files in a wrong directory with a wrong filename, or I am missing something here.

PS: Let me know if using pastebin to show my confs will help.

Best script ever

Thanks a lot for sharing this code, saved me countless hours of doing stuff manually!

Function defined twice and missing options

Hi,
First of all, many thanks for sharing your scripts.
Looking at the star.sh script, I saw that several functions were defined twice ...
Non-exhaustive list:
show_summary ()
run_calc ()
run_tar ()
The progress of the script seems to complete successfully, but it seems "dangerous".
On the other hand, I see 2 other potential problems:

  1. In "Transfer" mode, hard links are not preserved by the default options of rsync: No -H option
    (no problem for "backup" mode because tar natively takes into account the hard links).
    -S (--sparse) option is missing too in default options, for copying sparse files efficiently.
  2. In the "restore" mode, it seems important to provide the --numeric-owner option because of the use of an intermediate system (liveCD or liveUSB)
    see this point here http://www.gnu.org/software/tar/manual/tar.html#Attributes ; ‘--numeric-owner’
    an here : https://help.ubuntu.com/community/BackupYourSystem/TAR

Optional switch to omit copying the archive to destination

I have created an archive which is few GBs smaller than root partition. Most of its content will be placed in home which is put on separate partition. Right now I'm running out of disk space on root partition because of the archive being copied to it.

In worst case I could remove some files from the backup, but I wonder if it does sound reasonable to add a possibility to omit copying the archive - I'm reading it from external drive so I'm not concerned about performance.

[ERROR] /dev/sda1 is already mounted as /boot/efi, refusing to use it

Having an issue restoring an Ubuntu Server 18.04.05 installation from a live VPS to a VM on a local machine. Fully updated. Only new software are the requirements for STAR. Below is my command, its results, and my df and lsblk results if that helps.

System Tar & Restore 7.0
[INFO] UEFI environment detected. (use -W to ignore)
Checking archive type
[ERROR] /dev/sda1 is already mounted as /boot/efi, refusing to use it

df results:

System Tar & Restore 7.0
[INFO] UEFI environment detected. (use -W to ignore)
Checking archive type
[ERROR] /dev/sda1 is already mounted as /boot/efi, refusing to use it

lsblk results:

loop0    7:0    0 97.9M  1 loop /snap/core/10444
loop1    7:1    0 97.8M  1 loop /snap/core/10185
sda      8:0    0   25G  0 disk
├─sda1   8:1    0  512M  0 part /boot/efi
└─sda2   8:2    0 24.5G  0 part /

Original system df and lsblk

Filesystem         Size  Used Avail Use% Mounted on
/dev/ploop37935p1   30G   15G   14G  51% /
none               3.0G     0  3.0G   0% /sys/fs/cgroup
none               3.0G     0  3.0G   0% /dev
tmpfs              3.0G  4.0K  3.0G   1% /dev/shm
tmpfs              3.0G  1.2M  3.0G   1% /run
tmpfs              5.0M     0  5.0M   0% /run/lock
none               3.0G     0  3.0G   0% /run/shm
aaron@freder-graylog:$ lsblk
NAME           MAJ:MIN    RM SIZE RO TYPE MOUNTPOINT
ploop37935     182:606960  0  30G  0 disk
-ploop37935p1 182:606961  0  30G  0 part /

Most likely, I believe I'm misunderstanding how the boot system works in linux. But I'm unsure and haven't been able to find Google searches that match the error I see from this script.

Could You describe --destination option for backup

Hello.
Just simple question.
When I made backup like this:
bin/bash star.sh -i 0 -jq -c gzip -d "/mnt/dest/backup" -n "brickbackup" -T "/"
I got that final backup was located in:

 ls -al /mnt/dest/backup/Backup-2019-11-15
total 921992
drwxrwxrwx 2 root root      4096 Nov 15 03:35 .
drwxr-xr-x 3 root root      4096 Nov 15 03:35 ..
-rw-rw-rw- 1 root root       613 Nov 15 03:44 backup.log
-rw-rw-rw- 1 root root 944100431 Nov 15 03:44 brickbackup.tar.gz

How could I create fixed destination path for backup? I mean that if I use options
-d "/mnt/dest/backup" -n "brickbackup"
I get path for created backup indeed:
/mnt/dest/backup/brickbackup.tar.gz

Can system-tar-and-restore support compressing other partitions explicitly specified?

I have different partitions for my root (/) directory and my home dir (/home). Also I have other (Linux and data) partitions that I'd like to compress from top directory and take backup with system-tar-and-restore.

Now, only a field "Destination" is provided in order to set the store location. Could a field "Target" or something be created in order to explicitly define which directory the tarring should begin??

I know that this can be set from additional options (?) but it would be super easy and straightforward even for the noobest user.

Enhancement request: switch to wipe files from partition on restore

Here is my use case:

I'm a Linux noob although experienced IT consultant with Unix experience.
I've chosen to start with Arch, struggling through as a means to learn more Linux skills.
I tend to break things later in the piece (DE/WM environments), and want to create restore points at key intervals to save time rather than completely reinstalling bits I've done 20-30 times already ;-)
system-tar-and-restore is fantastic because the CLI doesn't require a WM or DE, so I can use it on a minimal Arch install from the virtual console.

Now, as I understand it, to properly restore back to a point in time, I need to clear out the root and home partitions. Otherwise there would be "left over" files that could conflict after restoring to an earlier date.

Also, I often have other partitions mounted:
/backups is an external USB stick (where I send star.sh backups),
/boot is my UEFI partition for dual-booting Windows, (wiping this would be a disaster)
/data is a partition for "data" (VMs, media, etc), (wiping this would be a disaster)
/nfs contains a NFS share from my NAS.

After Googling a bit, this is the approach I'm using to clear out the old partitions:

umount -R /mnt  
ls /mnt  # should be empty

mount /dev/mapper/vg00-Root /mnt
mount /dev/mapper/vg00-Home /mnt/home

cd /mnt 
ls . home                           # home and other root directories should not be empty
ls boot backups data nfs  # boot, backups, data, and nfs should (must) be empty
                                 
find /mnt -mindepth 1 -delete    # wipes root and home partitions

If I have the wrong partitions accidentally mounted under root (/mnt), issuing this command could be disastrous.

I know about the -x switch, but AFAIK this will not clear out root, it merely allows the restore into a non-empty root partition.

My request is a switch that would clear out root and optionally home, would do so in a "safe" manner (from someone smarter than a Linux noob), and would cleanly restore back to a point in time as per many commercial backup/restore applications (TimeMachine, etc, etc).

Perhaps something like:

dirs="bin etc sbin usr ..."
for d in dirs; do find /mnt/$d -mindepth 1 -delete; done ???

Whatever will properly clear out root (as fast as possible) and optionally home, yet not clear out any non-standard mount points in case they were accidentally mounted. Which they shouldn't be if star.sh is controlling the mounting of the partitions and the clearing out of old files.

Thanks for listening :)

Support Multi-core Compression with pigz and pbzip2

It would be nice to have multi-core support implemented while backing up the system.
Using pigz as compression program for gzip, I saved around half of the time.

Thank you very much for the script, I appreciate your work a lot.

Error while trying to backup using livecd

Hello.
First of all thank You to this utility.
When I made back up from working system all works well. To restore I used Live CD Antix and again all works well.

Is there any possibility to make backup on offline system using Live CD?
To make backup I booted from live USB with Antix linux (with additional data partition for storing archives). Then mount needed root fs of my system to /mnt/source and made backup:
star.sh -i 0 -jq -c gzip -d "/mnt/archive" -n "Backup-20191114-005040" -T "/mnt/source" -g
Log after backup is that:

[SUMMARY]
ARCHIVE
/mnt/archive/Backup-2019-11-14/Backup-20191114-005040.tar.gz (/mnt/source)

ARCHIVER OPTIONS
--exclude=Backup-2019-11-14

[ARCHIVER]
tar: source/tmp/.X11-unix/X0: socket ignored
75427 Files archived successfully
Elapsed time: 0 hours 9 min 39 sec

[CONFIGURATION FILE]
# Auto-generated configuration file for backup mode. Place it in /etc

BRdestination="/mnt/archive"
BRcompression="gzip"
BRname="Backup-20191114-005040"
BRnocolor="Yes"
BRquiet="Yes"
BRsrc="/mnt/source"

I see that gzip file of backup has one level that I do not need:

root@antix1:/mnt/archive/system-tar-and-restore-master# tar -tf ../Backup-2019-11-14/Backup-20191114-005040.tar.gz  | head -n 4
source/
source/home/
source/home/proof/
source/home/proof/.lesshst
root@antix1:/mnt/archive/system-tar-and-restore-master#

Next I tried to make restore and always got an error like this
Running and target system architecture mismatch or invalid archive

For example (standard options):

root@antix1:/mnt/archive/system-tar-and-restore-master# ./star-gui.sh
star.sh -i 1 -jq -f "/mnt/archive/Backup-2019-11-14/Backup-20191114-005040.tar.gz" -r /dev/sda1 -s /dev/sda5 -G /dev/sda
System Tar & Restore 7.0
Checking archive type

[MOUNTING]
Making working directory
Mounting /dev/sda1

[BACKUP ARCHIVE]
Checking and reading archive (75427 Files)

[CLEANING AND UNMOUNTING]
Unmounting /dev/sda1
root@antix1:/mnt/archive/system-tar-and-restore-master#

I used the --strip-components=NUMBER as additional options for tar to remove one level in the path of backed archive:

root@antix1:/mnt/archive/system-tar-and-restore-master# ./star-gui.sh
star.sh -i 1 -jq -f "/mnt/archive/Backup-2019-11-14/Backup-20191114-005040.tar.gz" -u "--strip-components=1" -r /dev/sda1 -s /dev/sda5 -G /dev/sda
System Tar & Restore 7.0
Checking archive type

[MOUNTING]
Making working directory
Mounting /dev/sda1

[BACKUP ARCHIVE]
Checking and reading archive (75427 Files)

[CLEANING AND UNMOUNTING]
Unmounting /dev/sda1
root@antix1:/mnt/archive/system-tar-and-restore-master#

And with override flag:

root@antix1:/mnt/archive/system-tar-and-restore-master# ./star-gui.sh
star.sh -i 1 -jq -f "/mnt/archive/Backup-2019-11-14/Backup-20191114-005040.tar.gz" -u "--strip-components=1" -r /dev/sda1 -s /dev/sda5 -G /dev/sda -o
System Tar & Restore 7.0
Checking archive type

[MOUNTING]
Making working directory
Mounting /dev/sda1

[BACKUP ARCHIVE]
Checking and reading archive (75427 Files)

[CLEANING AND UNMOUNTING]
Unmounting /dev/sda1
root@antix1:/mnt/archive/system-tar-and-restore-master#

What should I do to execute backup and restore operations from Live CD?
Thank You

Should I boot from the liveCD?

I'm going to backup my ubuntu 14.04
Should I boot from the liveCD?
Or is it ok to boot from ubuntu 14.04?

/var/log/syslog doesn't working

-rw-r----- 1 sshd adm 363401 Apr 27 14:08 syslog
# chown syslog:adm syslog* (works fine after this command)
-rw-r----- 1 syslog adm 363862 May 10 17:17 syslog

why changed ownership?

Any thought to implement a .desktop file for menu entry?

Hi @tritonas00, I wrote an ebuild for Gentoo and already opened a bug in order for the Dev's to check it out. I think that a menu entry for the gui wrapper might be good.

It would require root's passwd and would also have a nice description, icon and stuff.

What do you think about it? Although I am kind of noob, I am willing to give a try and help you out with these. :)

Date format in default file name causes tar error

Trying to open the archive with the default file name Backup-$(hostname)-$(date +%Y-%m-%d-%T) with tar -ztvf backup.tar.gz results in the error

tar (child): Cannot connect to Backup-localhost-19-07-2015-20: resolve failed
gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now`

After searching the internet, I ran across the following line from the GNU Tar documentation:

If the archive file name includes a colon (`:'), then it is assumed to be a file on another machine.

So basically the colon in the time format causes the error. This could be easily fixed by setting a slightly different default file name for backups, e.g. with $(date +%Y-%m-%d__%H_%M) as the date variable.

system-tar-and-restore does not work with nvme SSD drive

Sending this from work, not in front of my system, but hopefully my memory will suffice :)

star.sh did not work on my system which has an nvme SSD drive. IIRC the backup worked ok but the restore failed. I think it was complaining about not finding the boot partition (?).

Anyway, I grepped the script for the error msg, found the scan_part() and scan_disk() functions, and patched the script.

The solution was to clone the appropriate lines with the regex: nvme[0-9]+n[0-9]+p[0-9]+

The extent of my code review was limited to those two functions, which enabled the script to work.

My SSD partitions are named /dev/nvme0n1p1, /dev/nvme0n1p2, etc.

Happy to send more details from home if you need more info.

Thanks for the great work, much appreciated! 👍

home directory is not backed up completely

When using star.sh with the following arguments:

#./star.sh -i 0 -d /media/user/Backup

the resulting tar file contains an incomplete home directory.

content of original home directory:

#################################################

[REDACTED]

#################################################

the content of the resulting tar file's home directory is only:

#################################################
[REDACTED]
#################################################

log:

#################################################
[REDACTED]

#################################################

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.