• System Image Backup


    I am now looking to get an image of my system and have questions.

    Looking to use Fsarchiver or Clonezilla but currently have Fsarchiver on a 16GB thumb drive.

    Haven’t tried to use it yet so not sure if it’s simple. My question though is how does the backup work. How large is it and will it fit on the thumb drive or do I need another drive/location to put it?

    Is there a good tutorial for doing a backup from start to finish?

  • To add to this.

    My drive is 500GB using about 91GB I believe.

  • @noobertroon said in System Image Backup:

    Haven’t tried to use it yet so not sure if it’s simple.

    Everything seems to be difficult before tried for the 1st time. After that it seems pretty simple :) .

    My question though is how does the backup work.

    I’ll try to describe some basic fsarchiver operations only. We’ll backup | restore entire partitions. Fsarchiver may also backup | restore only a selected folders. It is not described here.

    The basic syntax is:

    fsarchiver operation switches backup-filename what-to-backup-or-restore
    

    where

    • fsarchiver is the command itself

    • operation is usually one of the three:

      • savefs creates a backup
      • restfs restores a backup
      • archinfo shows the info about a backup
    • switches I generally use these three:

      • -v be verbose
      • -j5 creates 5 (de)compression threads on multicore CPUs; more threads, faster backups
      • -z7 use the 7th level of compression; it goes from 0 to 9; higher the compression, slower the backup
    • backup-filename the backup file to be created | restored. May be placed anywhere in the file system

    • what-to-backup-or-restore the list of target partitions (or folders) to backup, or the list of destionation partitions where backed up partitions must be restored to

    Let’s see a practical example. This computer has two internal hard disks, sda and sdb. Antergos is installed in:

    • sda8 contains Gnome3rd, partition’s label is asg = Antergos Stable Gnome3rd

    • sda9 contains Mate, partition’s label is asm = Antergos Stable Mate

    • sda10 contains Cinnamon, partition’s label is asc = Antergos Stable Cinnamon

    • sda11 contains Plasma, partition’s label is asp = Antergos Stable Plasma

    All my Linux partitions are always 20G in size. A medium Linux installation occupies from 5G to 15G. My data files are kept in the huge separate data partitions, from 500G to 1T each. The data partition(s) are common to all Linuxes, shared between them. Any file within the data partition may be accessed from any installed Linux, there’s no need to duplicate a file. We’ll not backup the data partition in this example. Only the pure Linux partitions.

    I’m currently not in one of these four partitios, which I want to backup. I’m in Arch Mate on sda13 partition. All four Antergos partitions are not mounted, so we can work with them, backup or restore.

    I attach an external USB disk. It has AlexStar label, has the alexboss folder (corresponds to the name of this laptop), and is automatically mounted under /run/media/just folder:

    ┌──[just]@[alexatm]:~$
    └─> ls -lha /run/media/just/AlexStar
    total 68M
    drwxr-xr-x  9 just users 4.0K Mar 23 12:46 .
    drwxr-x---+ 3 root root    60 Apr 10 08:51 ..
    drwxrwxrwx  2 just users  16K Apr  5 09:22 alexaero
    drwxrwxrwx  2 just users 4.0K Apr  5 16:56 alexbest
    drwxrwxrwx  2 just users  20K Apr  9 13:07 alexboss
    drwxrwxrwx  2 just users 4.0K Aug  5  2016 alexcore
    drwxrwxrwx  2 just users 4.0K Apr  5 09:25 alexhuge
    drwxrwxrwx  2 just users  16K Mar 10  2016 lost+found
    drwxrwxrwx  4 just users 4.0K Jul  7  2016 .Trash-1000
    -rw-r--r--  1 just  1001  68M Mar 23 12:38 zim.tar.gz
    ┌──[just]@[alexatm]:~$
    └─>
    

    Folder names correspond to other computers names I’m using. zim.tar.gz is the backup of the world’s best note taking application - venerable Zim.

    I want to backup all four Antergos partitions - from sda8 to sda11 - to external USB disk, and place the backup file into the alexboss folder on it.

    I usually name backups following the scheme:

    compname-backdate-backtime-backparts-lbl01-lbl02-lbl03-lbl04-distroname-comment
    

    where:

    • compname is the computer’s name I’m backing up

    • backdate the date of backup

    • backtime the time of backup

    • backparts partitions labels being backed up; my labels are always exactly 3 chars long

    • distroname the name of the distro being backed up

    • comment a very brief note | comment about the backup

    The command to backup four Antergos Linux partitions onto the external AlexStar USB disk is:

    sudo ionice fsarchiver savefs -v -j5 -z7 /run/media/just/AlexStar/alexboss/alexboss-20170410-1200-sda8to11only-asg-asm-asc-asp-antergos174-example4forum /dev/sda8 /dev/sda9 /dev/sda10 /dev/sda11 && sync
    

    where:

    • sudo must be used for fsarchiver
    • ionice keeps GUI fluid during heavy disk I/O operations
    • sync synces all disks writes, so USB may be safely detached once the backup is finished

    The command to restore four Antergos Linux partitions from the external AlexStar USB disk to theis original paritions is:

    sudo ionice fsarchiver restfs -v -j5 /run/media/just/AlexStar/alexboss/alexboss-20170410-1200-sda8to11only-asg-asm-asc-asp-antergos174-example4forum.fsa id=0,dest=/dev/sda8 id=1,dest=/dev/sda9 id=2,dest=/dev/sda10 id=3,dest=/dev/sda11 && sync
    

    The best of fsarchiver is the fact that a backup may be restored not only to original partition(s) but into any partition we want, on the same computer or another. I shift 4 original partitions by 4 toward the end of the disk. From sda8-11 to sda12-15:

    sudo ionice fsarchiver restfs -v -j5 /run/media/just/AlexStar/alexboss/alexboss-20170410-1200-sda8to11only-asg-asm-asc-asp-antergos174-example4forum.fsa id=0,dest=/dev/sda12 id=1,dest=/dev/sda13 id=2,dest=/dev/sda114 id=3,dest=/dev/sda15 && sync
    

    We can restore only some partition(s) from a backup. Lets restore Antergos Mate and Plasma only, into sda1 and sda2:

    sudo ionice fsarchiver restfs -v -j5 /run/media/just/AlexStar/alexboss/alexboss-20170410-1200-sda8to11only-asg-asm-asc-asp-antergos174-example4forum.fsa id=1,dest=/dev/sda1 id=3,dest=/dev/sda2 && sync
    

    Destination partitions may be of any size, they don’t have to be of the same size as backed up partitions, may be smaller or larger. Destination partitions must only be large enough to hold all files, stored in the backup.

    In this example destination parts may go from smth about 10G up to 9(9)Z. See below.

    You didn’t follow my naming scheme and forgot what partitions were backed up, their labels, how much disk space is effectively used within each partition, backup date? No problem, let’s get archive’s info:

    fsarchiver archinfo /run/media/just/AlexStar/alexboss/alexboss-20170410-1200-sda8to11only-asg-asm-asc-asp-antergos174-example4forum.fsa
    

    Depending on computer in use, four partitions are backed up in 30-45 minutes. One partition is restored in 3-5 minutes. All four are restored in 12-15 minutes.

    How large is it and will it fit on the thumb drive or do I need another drive/location to put it?

    Let’s continue the example. These are real numbers:

    • sda8=20G, asg, real space used = 6,04G Gnome3rd
    • sda9=20G, asm, real space used = 6,80G Mate
    • sda10=20G, asg, real space used = 6,03G Cinnamon
    • sda11=20G, asg, real space used = 8,89G Plasma

    Four parts take 80G on the disk. The sum of the space, actually occupied by the files, is about 28G. Plus, the space occupied by ext4 itself, about 4 x 500M = 2G. The archive size is 10G. Fsarchiver has reduced 30G down to 10G. Not bad? Very good.

    Is there a good tutorial for doing a backup from start to finish?

    I’m not aware of any. Fsarchiver’s –help and man are excellent:

    fsarchiver --help
    
    man fsarchiver
    
  • That is an insane amount of detail. Thank you very much for that.

    Cookies for you!

  • I was going to just do it but…

    So I believe I understand exactly how to do it, it seems simple with your explanation.

    The only question is how big the backup image is going to be. I need to know this so I can make sure I use a large enough drive to use. You said how large your ones are but that does not help me understand how large mine will be.

    I am using a 500GB SSD with about 95GB used. Is there a way to find out how large it will be before the process starts?

  • In the beginning i was using dd but that’s too crasy to do a weekly backup, so fsarchiver is the way i go since this topic:
    https://forum.antergos.com/topic/4864/clone-an-entire-antergos-system-to-an-other-older-laptop

    Now i have a simple txt file with the proper fsarchiver command that i simple copy and paste in terminal ones in a week or so.
    Very easy, smooth and soficated, that is fsarchiver, once you have used it a few times and read about it.

    When i get to know how to make scripts to run, i will make one.

  • Uh ok…just already answered this…and is quite clear how to do.

    just asking how big an image of my drive will be.

  • @noobertroon said in System Image Backup:

    …just asking how big an image of my drive will be.

    It will be roughly a half in size compared to space, occupied by the files.

    Use any of two methods to find out the space, occupied by the data in file system - gparted or du.

    1. Gparted:

    0_1492147482819_gparted.png

    I’m in sda10 = asc (Antergos Stable Cinnamon) partition. The space used is 7.09 GiB.

    1. In terminal, run:
    sudo du -csxh /
    

    Example:

    ┌──[just]@[alexasc]:~$
    └─> sudo du -csxh /
    6.7G	/
    6.7G	total
    ┌──[just]@[alexasc]:~$
    └─> 
    

    The du command doesn’t count the space, used by journal in journaling file systems. Not to be confused with journal introduced in ridiculous systemd Poettering’s thingie. By default, journal equals to 2.5% of the file system size. On 20 G partition the journal size is 500 M. On empty, with no files, 20 G partition 500 M are already occupied by the file system’s journal.

    Sum journal’s 500 M to 6.7 G returned by du:

    6.7G + 0.5G = 7.02G

    It’s roughly the same value shown in Gparted.

    With default fsarchiver compression level, -z3, the archive file is a half in size compared to the size, occupied by the data. 100G of data are compressed to 50G. 10G of data are compressed to 5G. 7G are reduced to 3.5G. With higher compression levels fsarchver reduces archive size to even lower numbers. With -z7 archive size is about a one third of the data size. Remember - higher compression level, slower fsarchiver operation.

    Edit

    I must to refine the text above. Differently from Clonezilla, Fsarchiver ignores and does not include file system’s journal in a backup. Fsarchiver backups user files only. In the example, Fsarchiver backups only 6.7G of user data in the / partition - the value, returned by du. Journal is created from scratch during restore - Fsarchiver uses the standard mke2fs command to format a destination partition.

  • @just Put this at the Antergos wiki please!
    I tried to create a virtual disk to backup a VM using your very same commands, but didn’t work.
    I created a partition table and formated as ext4, not sure what went wrong, but i guess i mounted (or not even mounted) the backup disk.
    For now i know how to use clonezilla, but is “useless” to back up huge partitions, fsarchiver is interesting since it backs up only the used space. I really need to learn how to make it work.

    Antergos (default OS) - WIN10 (abandoned)
    I3wm - Mate desktop
    AMD - A4 7300 Radeon graphics
    16 GB ram
    HD 1 TB
    Linux newbie since 06/2016

  • @fernandomaroto said in System Image Backup:

    @just Put this at the Antergos wiki please!

    I’m not sure it deserves to be placed in the wiki. The text doesn’t add anything new to standard fsarchiver --help and man fsarchiver. It only rephrases them in simpler words, nothing more. It has no additional value.

    Don’t know what to do with it. It seems a bit naive to add such a simple thing to the wiki.

    I tried to create a virtual disk to backup a VM using your very same commands, but didn’t work.

    I never use VMs. It’s like trying to smell a rose in a gas mask. Wrong feelings.

    I created a partition table and formated as ext4, not sure what went wrong, but i guess i mounted (or not even mounted) the backup disk.

    The rule is simple. All partitions to be backed up must be unmounted. The partition where the backup will be stored must be mounted.

    Example.

    You want to backup sdb5, sdb10, sda7, sda15 partitions. They must be not mounted.

    You want to backup them to sdc2 partition. sdc2 must be mounted.

    For now i know how to use clonezilla, but is “useless” to back up huge partitions, fsarchiver is interesting since it backs up only the used space. I really need to learn how to make it work.

    It’s not quite correct - Clonezilla is not useless. Yes, it backs up every single bit of a partition or disk, including the space not used by user files. But Clonezilla also compresses the backup, as Fsarchiver does. Clonezilla will compress a 100G of empty disk space into smth about 100M.

    With Clonezilla any disk or partition may be restored exactly to a factory settings. For example, you bought a new device with WindOS on it and want to purge it out. Back it up with Clonezilla before purging. You’ll be always able to restore the device to its original WindOS state.

    Fsarchiver may not be used to do the same thing.

    Clonezilla is rigid but extremely reliable for mission-critical backups. Fsarchiver is very flexible but not suitable for “backbone” backups.

    With respect

  • Ok now you have confused me.

    Are we not creating Images of the system with both Clonezilla and Fsarchiver. Meaning you restore the system to the previous state (all apps, settings, everything).

    You are now making it sound like Fsarchiver is simply backing up some data.

  • I’m not sure it deserves to be placed in the wiki.

    i guess it deserves, i admit having not enough time to test fsarchiver further, nor reading the manual, i will as soon as possible

    I never use VMs. It’s like trying to smell a rose in a gas mask. Wrong feelings.

    hehehe, it’s a wonderful tool for people who learn more how to assembly pieces after breaking everything. I mean don’t want to risk using fsarchiver directly without learning how it can/should be used and avoid damaging my system (because i’m very newbie)

    The rule is simple. All partitions to be backed up must be unmounted. The partition where the backup will be stored must be mounted.

    Uhum, i just don’t remember what i did before, need to test again.

    It’s not quite correct - Clonezilla is not useless.

    That’s why i used quotes, maybe in portuguese the quotes meaning is clearer for what i meant, sorry. Clonezilla already saved me twice or more.

    I didn’t know that compressing the empty space would be such small (the final image was always so big to me), do you use a special compress rate to clonezilla too? (i use the graphical options)

    With respect

    And i thank you and all the comunity for your respect and your patience with me.

    Cheers!

    Antergos (default OS) - WIN10 (abandoned)
    I3wm - Mate desktop
    AMD - A4 7300 Radeon graphics
    16 GB ram
    HD 1 TB
    Linux newbie since 06/2016

  • @noobertroon said in System Image Backup:

    Ok now you have confused me…

    Clonezilla uses low-level approach - it backs up every single bit of a disk(s) or partition(s).

    Fsarchiver uses high-level approach - it backs up only real files, soft- and hardlinks included, of a partition(s). Fsarchiver cannot backup a disk.

    Clonezilla backups may be a bit larger than those of Fsarchiver. The difference is negligible.

    Use Clonezilla to backup and restore disk and partititions on WindOS devices.

    Use Fsarchiver to freely backup, restore, rearrange partitions on pure Linux devices.

  • You are very technical.

    I am running Antergos Linux on a 500GB SSD. I didn’t make any other partitions, so only one partition (well excluding any extra the system creates).

    I want this copied so that if my system gets messed up, I can wipe it clean, run the image program and put the image back on. I am then right back where I was before, as if I just rebooted.

    It sounds like Clonezilla is what I want then…

  • @noobertroon said in System Image Backup:

    You are very technical.

    I’m sorry.

    I am running Antergos Linux on a 500GB SSD. I didn’t make any other partitions, so only one partition (well excluding any extra the system creates).

    I want this copied so that if my system gets messed up, I can wipe it clean, run the image program and put the image back on. I am then right back where I was before, as if I just rebooted.

    It’s usefull and meaningfull, but I’ll skip it.

    It sounds like Clonezilla is what I want then…

    Yes, you’re right. Run Clonezille to backup the whole disk. Do everything you want with the disk after a backup. Clonezilla will always restore the disk to its origianl state.

  • @just So Clonezilla does the same as dd clone?
    Then i find dd easier and faster then Clonezilla.
    Ones a month a dd, ones a week a fsarchiver.

  • @bartatantergos said in System Image Backup:

    @just So Clonezilla does the same as dd clone?

    Yes and no. dd only copies a disk or partition(s) bit by bit, without compressing it. Clonezilla copies a disk or partition(s) bit by bit and compresses it.

    Then i find dd easier and faster then Clonezilla.

    Sure, dd is faster - it does not have to spend time compressing a data.

    Ones a month a dd, ones a week a fsarchiver.

    Clonezilla, fsarchiver, dd are all good backup tools. It’s important to have all data backed up, and be able to restore it from a backup.

  • @just And dd gzip:

    dd if=/dev/sdX conv=sync,noerror bs=64K | gzip -c  > /path/to/backup.img.gz
    

    is what i use.

    120Gb system partition becomes 3.8Gb backup image.

    https://wiki.archlinux.org/index.php/Disk_cloning

  • Can you use the above dd command or fsarchiver on a live filesystem? What about files that change while the dd/fsarchiver is running?

image10 backup10 system75 Posts 25Views 2650
Log in to reply