Is it possible to take a snapshot of / (or other) filesystem, like in VirtualBox?

Taking snapshot of root partition will make possible to roll back to previous state. This is very helpful when something went wrong and/or data loss occurs. This feature can be seen in VirtualBox HDD and the persistence option in live CD. Unlike backup it uses incremental data usage thus less data size. Is it possible to take a snapshot of a file system?


rsync

Taking snapshot of root partition will make possible to roll back to previous state

We call that a backup procedure and for incremental backups you can use rsync ;)

rsync is a utility software and network protocol for Unix-like systems (with ports to Windows) that synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. Quoting the official website: "rsync is a file transfer program for Unix systems. rsync uses the 'rsync algorithm' which provides a very fast method for bringing remote files into sync."3 An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction.why? rsync can copy or display directory contents and copy files, optionally using compression and recursion.

Remote Backup

Backup over a network is possible, preferably the user should mount the network share to be backed up to prior to launching the program. The share would then be listed in the Browse GUI and could easily be added. There is no separate section for network, if more advanced features are required the user is encouraged to look at alternatives, of which there are many.

Grsync

Grsync is a graphical front end:

enter image description here


More information:

  • https://help.ubuntu.com/community/rsync

The link has several examples on configuration.

Rsync allows you restore with a timestamp (so if have backups made every second you could also restore it to that second. Not that this is a workable method for a complete system ;-) )


Xen Hypervisor

There are more methods: Xen Hypervisor.

You could run all your operating systems in hypervisors (ie. virtual machines). Xen is an example of such a setup. Basically you turn ALL your operating systems into VMs and you can copy a VM container over to a new name and you would have a backup or restore point.

From the link:

Xen is a type 1, bare-metal virtual machine monitor (or hypervisor), which provides the ability to run one or more operating system instances on the same physical machine. Xen, like other types of virtualization, is useful for many use cases such as server consolidation and isolation of production and development environments (e.g. corporate and personal environments on the same system).

As of Ubuntu 11.10 (Oneiric), the default kernel included in Ubuntu can be used directly with the Xen hypervisor as the management (or control) domain (Dom0 or Domain0 in Xen terminology).

The rest of this guide gives a basic overview of how to set up a basic Xen system and create simple guests. Our example uses LVM for virtual disks and network bridging for virtual network cards. It also assumes Xen 4.1 (the version available in 12.04) and the xend toolstack. It assumes a familiarity with general virtualization issues, as well as with the specific Xen terminology. Please see the Xen wiki for more information.


LVM

Yet another method would be LVM

LVM stands for Logical Volume Management. It is a system of managing logical volumes, or filesystems, that is much more advanced and flexible than the traditional method of partitioning a disk into one or more segments and formatting that partition with a filesystem.

Snapshots

This is something you simply can not do without LVM. It allows you freeze an existing Logical Volume in time, at any moment, even while the system is running. You can continue to use the original volume normally, but the snapshot volume appears to be an image of the original, frozen in time at the moment you created it. You can use this to get a consistent filesystem image to back up, without shutting down the system. You can also use it to save the state of the system, so that you can later return to that state if you mess things up. You can even mount the snapshot volume and make changes to it, without affecting the original.


rsnapshot

rsnapshot iss a filesystem snapshot utility. It can take incremental snapshots of local and remote filesystems for any number of machines.

Local filesystem snapshots are handled with rsync. Secure remote connections are handled with rsync over ssh, while anonymous rsync connections simply use an rsync server. Both remote and local transfers depend on rsync.

Example:

[root@localhost /]# rsnapshot -v daily
echo 1842 > /var/run/rsnapshot.pid
/bin/rm -rf /.snapshots/daily.6/
mv /.snapshots/daily.5/ /.snapshots/daily.6/
mv /.snapshots/daily.4/ /.snapshots/daily.5/
mv /.snapshots/daily.3/ /.snapshots/daily.4/
mv /.snapshots/daily.2/ /.snapshots/daily.3/
mv /.snapshots/daily.1/ /.snapshots/daily.2/
mv /.snapshots/daily.0/ /.snapshots/daily.1/
mv /.snapshots/hourly.5/ /.snapshots/daily.0/
rm -f /var/run/rsnapshot.pid
[root@localhost /]#

You can do this with LVM, but only if you set up your partitions to use LVM to begin with.


What you really need is BTRFS

http://www.linux.com/learn/tutorials/767683-how-to-create-and-manage-btrfs-snapshots-and-rollbacks-on-linux-part-2

https://btrfs.wiki.kernel.org/index.php/Incremental_Backup

http://www.dedoimedo.com/computers/btrfs-snapshots.html