A new user interface for you! Read more...

File HOWTO of Package fsarchiver

QuickStart


How to save filesystems to an archive

Here is how to use FSArchiver to backup a partition of your disk. Let's
consider your linux operating system is installed on /dev/sda1 and you want to
back it up to a file on /mnt/backup. You can run this command from a livecd:

  fsarchiver savefs /mnt/backup/gentoo-rootfs.fsa /dev/sda1

You can also archive several filesystems in a single archive file:

  fsarchiver savefs /mnt/backup/gentoo-rootfs.fsa /dev/sda1 /dev/sda2 /dev/volgroup/lv01

Here is an example of output when we save two filesystems to an archive:

  # fsarchiver savefs -o /backup/backup-fsa/backup-fsa025-gentoo-amd64-20090103-01.fsa /dev/sda1 /dev/sda2 -v -j4 -A
  filesystem features:
  [has_journal,resize_inode,dir_index,filetype,sparse_super,large_file]
  ============= archiving filesystem /dev/sda1 =============
  -[00][REGFILE ] /vmlinuz-2.6.25.20-x64-fd13
  -[00][REGFILE ] /sysresccd/memdisk
  -[00][REGFILE ] /sysresccd/pxelinux.0
  -[00][REGFILE ] /sysresccd/initram.igz
  -[00][REGFILE ] /sysresccd/boot.cat
  .....
  -[00][DIR     ] /mkbootcd-gentoo64
  -[00][REGFILE ] /System.map-2.6.25.20-x64-fd13
  -[00][REGFILE ] /config-2.6.25.20-x64-fd13
  -[00][REGFILE ] /config-2.6.27.09-x64-fd16
  -[00][DIR     ] /
  ============= archiving filesystem /dev/sda2 =============
  -[01][SYMLINK ] /bin/bb
  -[01][REGFILE ] /bin/dd
  -[01][REGFILE ] /bin/cp
  -[01][REGFILE ] /bin/df
  .....
  -[01][REGFILE ] /fdoverlay/profiles/repo_name
  -[01][DIR     ] /fdoverlay/profiles
  -[01][DIR     ] /fdoverlay
  -[01][DIR     ] /


How to extract filesystems from an archive

FSArchiver supports multiple filesystems per archive. For that reason, you have
to specify which filesystem you want to restore. Each filesystem has a number
starting at 0. The first filesystem in the archive will be filesystem number 0,
the second will be filesystem number 1, ... You can restore either one
filesystem at a time, or several filesystems with just one command.
Here is how to restore a filesystem from an archive when there is only one
filesystem in that archive:

  fsarchiver restfs /mnt/backup/gentoo-rootfs.fsa id=0,dest=/dev/sda1

There is how to restore the second filesystem from an archive
(second = number 1):

  fsarchiver restfs /mnt/backup/archive-multple-filesystems.fsa id=1,dest=/dev/sdb1

You can also restore both the first and the second filesystem in the same time:
(numbers 0 and 1)

  fsarchiver restfs /mnt/backup/archive-multple-filesystems.fsa id=0,dest=/dev/sda1 id=1,dest=/dev/sdb1

Option -F was used to convert a filesystem in old version. For instance, it
allows to restore a filesystem which was ext2 when it was saved as reiserfs on
the new partition. Now, you have to specify option mkfs=xxx with the
destination partition. Here is how to restore the first filesystem from an
archive to /dev/sda1 and to convert it to reiserfs in the same time:

  fsarchiver restfs /mnt/backup/gentoo-rootfs.fsa id=0,dest=/dev/sda1,mkfs=reiserfs


Display info about an archive

It may be useful to know what has been saved in an archive. You can do this
using archinfo. It will tell you how many filesystems there are, their
properties, the original size of the filesystem and how much space is used:

   fsarchiver archinfo /backup/backup-fsa/sysimg-t3p5g965-debian-20100131-07h16.fsa

Here is an example of output: 
# fsarchiver archinfo /backup/backup-fsa/sysimg-t3p5g965-debian-20100131-07h16.fsa
====================== archive information ======================
Archive type:                   filesystems
Filesystems count:              2
Archive id:                     4b610c6e
Archive file format:            FsArCh_002
Archive created with:           0.6.6
Archive creation date:          20100131-07:16:35
Archive label:                  debian-backup
Compression level:              7 (lzma level 1)
Encryption algorithm:           none

===================== filesystem information ====================
Filesystem id in archive:       0
Filesystem format:              ext3
Filesystem label:               boot
Filesystem uuid:                d76278bf-5e65-4568-a899-9558ce61bf06
Original device:                /dev/sda1
Original filesystem size:       961.18 MB (1007869952 bytes)
Space used in filesystem:       356.86 MB (374190080 bytes)

===================== filesystem information ====================
Filesystem id in archive:       1
Filesystem format:              ext3
Filesystem label:               debian
Filesystem uuid:                4b0da78f-7f02-4487-a1e2-774c9b412277
Original device:                /dev/vgmain/snapdeb
Original filesystem size:       11.81 GB (12682706944 bytes)
Space used in filesystem:       7.11 GB (7635599360 bytes)


Multi-thread compression

FSArchiver also supports for multi-threaded compression. If you have
a multi-core processor (eg: dual-core or quad-core) you should create several
compression jobs so that all the cores are used. It will make the compression
or decompression a lot faster. For instance, if you have a dual-core, you
should use option -j2 to create two compression threads to use the power of the
two cores. If you have a quad-core cpu, option -j4 is recommended, except if
you want to leave one core idle for other programs. In that case you can use -
j3. Here is an example of multi-threaded compression:

  fsarchiver -j3 -o savefs /mnt/backup/gentoo-rootfs.fsa /dev/sda1


Splitting the archive into several volumes

If the archive file is very big, you may want to split it into several small
files. For instance, if the size of your backup is 8GB and you want to save it
on DVD+RW discs, it may be useful to split the archive into volumes of 4.3GB.
File splitting is supported ijn FSArchiver-0.3.0 and newer. To use it when you
create an archive, you just have to use option -s to specific the size you want
for each volume, in mega-bytes.

  fsarchiver savefs -s 4300 /data/backup-rhel-5.2-fsa033.fsa /dev/sda1

The first volume always have an .fsa extension. The names of the next volumes
will terminate with .f01, .f02, .f03, ... When you restore the archive, you
just have to specify the path to the first volume on the command line, and it
will automatically use the next volumes if they are in the same directory. Else
it will display a prompt, where you can specify another location for a volume.


Execution environment

FSArchiver requires the file-system tools to be installed to save the file-
system attributes (when you do a fsarchiver savefs) and it also requires these
tools to recreate the file-system when you do a fsarchive restfs. Anyway, you
only need the tools of the current file-system to be installed. In other words,
you don't require xfsprogs to be installed if you only work on an ext3 file-
system.
For these reasons, it's a good idea to run FSArchiver from an environment with
all the system tools installed. The best environment is the latest
SystemRescueCd-beta_version, since it comes with all the linux file-system
tools and a very recent FSArchiver version.
It's also important that you make sure that SELinux is not enabled in the
kernel running FSArchiver when you save a file-system which has been labeled by
SELinux, or you can use FSArchiver with SELinux enabled if you are sure that
the context where it's running has enough privileges to read the extended-
attributes related to SELinux. In the other cases, the kernel could return
unlabeled instead of the real value of the security.selinux attribute. Then
FSArchiver would not preserve these attributes and then the system would not
work when you restore your root filesystem, or you would have to ask the
SELinux to relabel the file-system. The SELinux support is disabled by default
if you use FSArchiver from SystemRescueCd-1.1.3 or newer, so your SELinux
labels will be preserved if you use FSArchiver from that environment.


Detection of the filesystems

FSArchiver is able to detect the filesystems which are installed on all
the disks of a computer. This is very useful when you want to work on
a partition when you don't know what is its device name.

  # fsarchiver probe simple
  [=====DEVICE=====] [==FILESYS==] [=====LABEL=====] [====SIZE====] [MAJ] [MIN]
  [/dev/sda1       ] [ext3       ] [boot           ] [   768.72 MB] [  8] [  1]
  [/dev/sda2       ] [reiserfs   ] [gentoo         ] [    12.00 GB] [  8] [  2]
  [/dev/sda3       ] [ext3       ] [data           ] [   350.00 GB] [  8] [  3]
  [/dev/sda4       ] [ext3       ] [backup         ] [   300.00 GB] [  8] [  4]
  [/dev/sda5       ] [lvm2pv     ] [               ] [   134.38 GB] [  8] [  5]
  [/dev/sda6       ] [lvm2pv     ] [               ] [   106.24 GB] [  8] [  6]
  [/dev/sdb1       ] [reiserfs   ] [usb8gb         ] [     7.46 GB] [  8] [ 17]


Command line and its arguments

  ====> fsarchiver version 0.6.7 (2010-01-31) - http://www.fsarchiver.org <====
  Distributed under the GPL v2 license (GNU General Public License v2).
  <usage>
   * usage: fsarchiver [<options>] <command> <archive> [<part1> [<part2> [...]]]
  <commands>
   * savefs: save filesystems to an archive file (backup a partition to a file)
   * restfs: restore filesystems from an archive (overwrites the existing data)
   * savedir: save directories to the archive (similar to a compressed tarball)
   * restdir: restore data from an archive which is not based on a filesystem
   * archinfo: show information about an existing archive file and its contents
   * probe [detailed]: show list of filesystems detected on the disks
  <options>
   -o: overwrite the archive if it already exists instead of failing
   -v: verbose mode (can be used several times to increase the level of details)
   -d: debug mode (can be used several times to increase the level of details)
   -A: allow to save a filesystem which is mounted in read-write (live backup)
   -a: allow running savefs when partition mounted without the acl/xattr options
   -e <pattern>: exclude files and directories that match that pattern
   -L <label>: set the label of the archive (comment about the contents)
   -z <level>: valid compression level from 1 (very fast)  to  9 (very good)
               default=3
   -s <mbsize>: split the archive into several files of <mbsize> megabytes each
   -j <count>: create more than one compression thread. useful on multi-core cpu
   -c <password>: encrypt/decrypt data in archive. password length:
                  6 to 64 chars
   -h: show help and information about how to use fsarchiver with examples
   -V: show program version and exit
<information>
 * Support included for: lzo=yes, lzma=yes
 * fsarchiver is still in development, don't use it for production.
<examples>
* save only one filesystem (/dev/sda1) to an archive:
   fsarchiver savefs /data/myarchive1.fsa /dev/sda1
 * save two filesystems (/dev/sda1 and /dev/sdb1) to an archive:
   fsarchiver savefs /data/myarchive2.fsa /dev/sda1 /dev/sdb1
 * restore the first filesystem from an archive (first = number 0):
   fsarchiver restfs /data/myarchive2.fsa id=0,dest=/dev/sda1
 * restore the second filesystem from an archive (second = number 1):
   fsarchiver restfs /data/myarchive2.fsa id=1,dest=/dev/sdb1
 * restore two filesystems from an archive (number 0 and 1):
   fsarchiver restfs /data/arch2.fsa id=0,dest=/dev/sda1 id=1,dest=/dev/sdb1
 * restore a filesystem from an archive and convert it to reiserfs:
   fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=reiserfs
 * save the contents of /usr/src/linux to an archive (similar to tar):
   fsarchiver savedir /data/linux-sources.fsa /usr/src/linux
 * save a filesystem (/dev/sda1) to an archive split into volumes of 680MB:
   fsarchiver savefs -s 680 /data/myarchive1.fsa /dev/sda1
 * save a filesystem and exclude all files/dirs called 'pagefile.*':
   fsarchiver savefs /data/myarchive.fsa /dev/sda1 --exclude='pagefile.*'
 * generic exclude for 'share' such as '/usr/share' and '/usr/local/share':
   fsarchiver savefs /data/myarchive.fsa --exclude=share
 * absolute exclude valid for '/usr/share' but not for '/usr/local/share':
   fsarchiver savefs /data/myarchive.fsa --exclude=/usr/share
 * save a filesystem (/dev/sda1) to an encrypted archive:
   fsarchiver savefs -c mypassword /data/myarchive1.fsa /dev/sda1
 * extract an archive made of simple files to /tmp/extract:
   fsarchiver restdir /data/linux-sources.fsa /tmp/extract
 * show information about an archive and its file systems:
   fsarchiver archinfo /data/myarchive2.fsa


Compression

Recent fsarchiver version comes with support for four different compression
algorithms:

* lzo: it is very fast compression but it does not compress well. You can use
  it if you have a very slow cpu
* gzip: it is the most common compression algorithm. It's quite fast and the
  compression ratio is good.
* bzip2: it is a quite slow compression algorithm, but it has a very good
  compression ratio.
* lzma: it's a quite recent algorithm. It has an excellent compression ratio
  but it's very slow to compress and quite fast to decompress.

Each algorithm provides several levels of speed/efficiency. The compression
algorithm you will use depends on how fast your processor is, how much disk
space you have, and how big the archive can be. By default, fsarchiver is
compressing using gzip with its sixth level of compression.


Installation

All these compression algorithms are implemented in libraries that fsarchiver
is using. It means you need these libraries to be installed on your computer to
compile fsarchiver with the support for these compression algorithms. gzip and
bzip2 are very common so it must not be a problem. lzo is not always installed
so you may have to install it, or to disable the support for lzo compression.
The lzma algorithm is implemented in liblzma. This library is very recent: it
comes with a package called xz_utils (it was called lzma-utils before), and
this library is not yet bundled with linux distributions. So you will have to
install it yourself, or you can disable the support for lzma compression when
you compile fsarchiver. If you have problems to compile fsarchiver from
sources, it's recommended to use the static_binary since it does not require
any library to work, and it supports everything that fsarchiver can do.


Multi-threading

fsarchiver is able to do multi-threading. Unlike many compression programs that
can use only one cpu to compress, fsarchiver can use all the power of your cpus
if you have a a cpu with multiple cores (dual-core, quad-core) or more that one
cpu. It means that it can compress about four times faster on a computer with a
quad-core processor for instance.
By default, fsarchiver just creates one compression threads, so it just uses
one processor. To enable the multi-threading compression/decompression, you
have to run fsarchiver with option -j X, where X is the number of compression
threads you want. In general, it's good to have as many compression jobs as
there are processors/cores available, except if you want to leave enough power
for other tasks. If you have a processor with multiple cores, you can combine
the multi-threading compression with a very high compression level. That way
you will have a very good compression ratio and it should not take too much
time to compress. Keep in mind that you can use the multi-threading option at
compression as well as decompression, even if it's more interesting at
compression which needs more power.


Compression levels available

FSArchiver-0.3.6 (and more recent versions) provides nine different compression
levels. You can choose the compression level to use when you create an archive
(by doing a savefs or savedir). You just have to use option -z X where X is the
level to use. when you use a low number, the compression will be very quick and
less efficient. The memory requirement for compressing and decompressing will
be small. The higher the compression level is, the better the compression will
be and the smaller the archive will be. But good compression levels will
require a lot of time, and also the memory requirement can be very big.
 ________________
|Level|Equivalent|
|___1_|___lzo_-3_|
|___2_|__gzip_-3_|
|___3_|__gzip_-6_|
|___4_|__gzip_-9_|
|___5_|_bzip2_-2_|
|___6_|_bzip2_-5_|
|___7_|__lzma_-1_|
|___8_|__lzma_-6_|
|___9_|__lzma_-9_|



High compression levels

bzip2 and lzma are the best compression algorithms available with fsarchiver.
In general, bzip2 is 15% better than gzip, and lzma is 15% better than bzip2.
Better means that the archive is 15% smaller in these examples.
Lzma has another interesting feature: its decompression is very fast, about
three times faster than bzip2, even if its compression is better. So if you
accept to spend more time at compression, the medium lzma will provide a file
which is smaller than what an average bzip2 could do, and it will decompress
faster. It's very interesting if you want to create an archive just once, and
to extract it several times (ex: software deployment).
If you don't want the compression to be too slow, you can also use the fastest
lzma option, which will be just as good as an average bzip2, and the
compression will take the same time, but it will be a lot faster to decompress
than bzip2. So the fastest lzma option is often a better choice than an
average/good bzip2.


Memory requirement

You must be aware that high lzma compression levels require a lot of memory
especially at compression time. These levels of compression are recommended on
recent computers having multiple-cores (Dual-core and Quad-core cpus) and few
GB of memory. If the compression fails because of a lack of memory, the
uncompressed version of the data will be written to the archive and an error
message will be printed in the terminal (but the archive will still be valid as
long as fsarchiver continues to run). In that case, using a lower compression
level is recommended since it's likely to work.
You can read the following topic_about_memory_problems. You can see that there
is a huge difference between a typical savefs command using -z8 (172100 KiB are
used) and -z9 (754076 KiB are used).
If you use multi-threading, there will be several compression-threads running
in the same time, each one is using some memory. Multi-threading compression
will be faster or multi-core processors or systems with more than one cpu in
general, but the compression ratio is the same.
In our tests, the same fsarchiver command with two threads and compression
level z9 is using 1438MB of memory instead of 754MB when it has only one
compression thread. This is because each compression thread requires a large
amount of memory when the highest compression level is used (-z9). You can have
many compression threads if you don't use the maximum compression level, the
amount of memory required will be normal.
The biggest part of the memory requirement is the compression threads. The more
compression threads you have, the more memory you need. Very high compression
levels (especially -z9) requires a huge amount of memory. If you don't have
enough memory, use -z8 rather than -z9 or disable the multi-threading if you
have time.


Live-backup

FSArchiver can be used to backup linux operating systems when they are running.
In other words, if you have linux installed on your hard disk, and it's
currently running, you can make a backup of that disk using fsarchiver. It's
called a live backup or hot backup. All you need is an fsarchiver binary, an
another filesystem where to save the archive. It can be on another partition on
the hard-disk, or a network file-system such as Samba of NFS.


Backup with a snapshot

If the partitions you want to save are LVM (Logical volume Manager) Logical-
Volumes, and it you have free extents in the Volume-Group, then you can make a
filesystem snapshot of these Logical-Volumes. A snapshot if a frozen copy of a
Logical-Volume made at a given time. After that time, the original partition
can still be modified normally, and the snapshot provides a consistent
filesystem that can be backed up. To create an LVM snapshot, you have to use
lvcreate with option --snapshot, and then the snapshot can be mounted read-only
on a directory. By default, all the partitions except /boot are configured as
Logical-Volumes with recent Redhat-Enterprise and Fedora distributions. You can
have the list of all your Logical-Volumes with the command called lvdisplay. If
this command is not installed on your system, you are probably not using LVM.

  # lvdisplay -c
    /dev/vgmain/distfiles:vgmain:3:1:-1:1:12582912:1536:-1:0:-1:251:21
    /dev/vgmain/misc:vgmain:3:1:-1:1:50331648:6144:-1:0:-1:251:29
    /dev/vgmain/tftpboot:vgmain:3:1:-1:1:1048576:128:-1:0:-1:251:30
    /dev/vgmain/vdisk:vgmain:3:1:-1:1:209715200:25600:-1:0:-1:251:31
    /dev/vgmain/chrooti386:vgmain:3:1:-1:2:1572864:192:-1:0:-1:251:32


Backup with no snapshot

If your partition are not LVM Logical-Volumes, you can't make a snapshot. If
the partition are not used, it's recommended to remount it as read-only, with
the following command:

  mount -o remount,ro /dev/xxx

If the partition cannot be remounted read-only (which is the case of the root
filesystem in general), it's still possible to use fsarchiver to make a backup,
but you will have to take extra care. By default, fsarchiver complains if you
try to save a filesystem which is mounted in read-write mode. This is because
in cannot guarantee that the data will be consistent because files may change
during the backup of the filesystem. This is the reason why it shows the
following error message, and stops:

  # fsarchiver savefs /mnt/archives/gentoo-backup-20090328-01.fsa /dev/sda2 -v
  create.c#0642,filesystem_mount_partition(): partition [/dev/sda2] is mounted read/write.
       please mount it read-only and then try again. you can do "mount -o remount,ro /dev/sda2".
       you can also run fsarchiver with option '-A' if you know what you are doing.
  removing /mnt/archives/gentoo-backup-20090328-01.fsa

When a filesystem is writeable during the backup, it means changes can be done
in files during that time, and there may be inconsistencies in the data. For
instance, if you are backing up a web server which is running both Apache and
Mysql, the Mysql database refers to files that can be uploaded in the Apache
directory from the website. In that case the backup could contains a reference
in the database but not the referred file because these files have been backed
up already. So you have to know whether or not your system may have such
inconsistencies.
If there is no risk of inconsistency, then you can use fsarchiver with option -
A to continue the backup of a filesystem which is mounted in read-write mode.


Restoration

If you have a problem on your filesystems, you may want to restore the live-
backup you made. You cannot restore a filesystem which is mounted, so it's
necessary to restore from a Linux-Rescue system. We recommend that you use
SystemRescueCd for multiple reasons:

* it comes with a recent version of fsarchiver
* you can boot it from the cdrom, an usb_stick, or from_the_network.
* it contains all_the_filesystem_tools that fsarchiver may need


Attributes


Preservation of attributes

FSArchiver has been written with the preservation of everything in mind. We
want to be sure that a filesystem saved with fsarchiver will keep both the
filesystem attributes (filesystem features, label, uuid) and all the file
attributes (contents, timestamps, owner, permissions, extended attributes, acl,
...). There is no need to specify any option in fsarchiver to preserve these
sort of things. This is the default behaviour. The down side is you may have
error about the mount options when the extended-attributes or the ACLs are not
visible.


Mount options required

The standard attributes (permissions, owner, ...) are always visible.
Unfortunately, the extended-attributes and the ACL (which are stored as
extended-attributes) may not be visible by the programs when the file-system is
mounted with the wrong options. For example the ext3/ext4 filesystem may have
to be mounted with options "user_xattr" and "acl". It depends on the "default
mount options". If these required options are set as "default mount options" in
the superblock of the filesystem, then it's not necessary to specify these
options then you mount it, or when it's mounted via fstab. Here is an example
of a partition which has "acl" as a default mount option, but "user_xattr" is
not:

  # dumpe2fs -h /dev/sda1 | grep -i "default mount options"
  dumpe2fs 1.41.4 (27-Jan-2009)
  Default mount options:    acl

If these mount options are not used, the risk is that extended attributes or
ACLs may have been written in the filesystem in the past, and these attributes
are now invisible because of the mount options. Then fsarchiver will warn about
it because it cannot save these attributes and they would be lost when you
restore the filesystem. Fortunately, this is an extreme case. In general, if
the mount option does not allow extended-attributes or ACL to be seen, it just
means you don't have that in the filesystem. The bad scenario may happen if you
mount a filesystem from different operating systems, or with different mount
options during the time.


Errors about the mount-option and solutions

When you try to save a filesystem with fsarchiver, it will check that all the
required mount options that allow to see the extended-attributes and the ACLs
are ok. If they are not, it will complain with the following error message:

  # fsarchiver savefs /mnt/archives/gentoo-backup-20090328-01.fsa /dev/sda1 -A
  create.c#0674,filesystem_mount_partition(): partition [/dev/sda1] has to be mounted with
         options [user_xattr] in order to preserve all its attributes. you can use mount
         with option remount to do that.
  create.c#0681,filesystem_mount_partition(): fsarchiver cannot continue, you can use
         option '-a' to ignore the mount options (xattr or acl may not be preserved)
  removing /mnt/archives/gentoo-backup-20090328-01.fsa

The first solution is to remount the partition using mount with the remount
option:

  mount -o remount,acl,user_xattr /dev/xxx

You can also decide to ignore this error if you have no such attributes on your
filesystem, or if you don't want it to be preserved. In that case you can just
run fsarchiver with the option -a and the operation will be able to continue.

  # fsarchiver savefs /mnt/archives/gentoo-backup-20090328-01.fsa /dev/sda1 -
  A -a


SELinux (Security Enhanced Linux)

Several important Linux distribution support SELinux, which is a Security
Enhancement option that can be either enabled or disabled on your system. If
SELinux is enabled, it may have two impacts on fsarchiver:

it can impact the programs that are running (including fsarchiver)

If SELinux is enabled when you save filesystems to an archive, you must check
that there is no restriction that may impact fsarchiver. So you can save a
filesystem on a system having SELinux enabled as long as it does not block
fsarchiver. But it's recommended to restore filesystems using fsarchiver from
an environment where SELinux is disabled or not supported. You can use
SystemRescueCd which does not have SELinux enabled. The problem with SELinux
during a restoration is that it can create labels on each file that is being
restored, even if the original filesystem had no such labels.

its attributes have to be preserved (else you could have problems to boot)

If the operating system that you want to backup has SELinux enabled, it's
important to make sure that fsarchiver will preserve the SElinux labels, else
your operating system may not boot properly after a restoration. Fortunately,
this is the default behaviour: fsarchiver preserves all the file attributes by
default, including the extended attributes, and SELinux labels are implemented
as normal extended attributes. So fsarchiver is able to preserve the SELinux
labels on any system that supports the extended attributes, as long as it can
read and write the extended attributes on the filesystems where it is working.


Cloning-ntfs

FSArchiver can now be used to clone NTFS partitions, so it can be used to clone
partitions where Windows is installed or where Windows data are saved. It can
be used to make a backup of your Windows installation, or it can be used to
clone a Windows installation to another computer. FSArchiver will preserve all
the files and their attributes with the limitations listed below. FSArchiver is
able to do flexible backups. It means you will be able to restore the ntfs
filesystem to a partition with is bigger or smaller than the original one, as
long as it's big enough to store all the data. It's very different from
partimage which is doing a static copy at the block level, and then partimage
is not able to restore a filesystem to a smaller partition. Tests have been
made with Windows XP, 2003, Vista, and fsarchiver has been able to save and
restore the ntfs filesystem. After the restoration Windows was still bootable
even if the partition is smaller or bigger. You must be aware that Windows
2000/XP/2003 may not be able to boot if you clone it to a computer which has a
different hardware (motherboard), but you may try. It should work when you
clone Vista on a different hardware.

Requirements

To clone NTFS partitions, you need a recent version of ntfs-3g2009.11.14 or more
recent, and a recent fsarchiver release. It's recommended to use the latest
version of these two programs. The most convenient way to use it is to run
fsarchiver from SystemRescueCd. It's a livecd that comes with fsarchiver and all
the filesystems tools.

Current status

Since fsarchiver is a quite recent program, you must be careful: it's not yet
considered as stable so there is a risk that data are not preserved or that you
don't get what you expect when you restore your partition because it may still
have bugs. Fortunately there is no risk to damage your original partition when
you just save its ntfs filesystem to an archive. The partitions are mounted
read-only during the backup, so you can save an NTFS partition to an archive,
and try to restore it somewhere else.

Limitations

* FSArchiver is currently unable to archive files which are encrypted on an
  NTFS partition. It should be possible later when user.ntfs.efs_info is
  available in ntfs-3g-AR. It means the archive will not contain a copy of the
  encrypted files, and then these files will be lost when you restore the NTFS
  partition from the archive. A "Permission denied" error message like the
  following one will be displayed during the backup if there are encrypted
  files on the partition:

  [errno=13, Permission denied]: create.c#148,createar_obj_regfile_unique():
  Cannot open /Temp/encrypted-test-file.txt for reading

* FSArchiver is unable to save Alternate-Data-Streams larger than 64k which are
  associated with files. Streams are additional contents which are associated
  with files. In general it's used to store extra info about a file: for
  instance you can set comments on files from the explorer, these comments will
  be stored in Streams, and the normal contents of the file won't be altered.
  An error message like that one will be displayed if large streams are seen:

  create.c#265,createar_item_xattr(): file [/Temp/file-with-large-stream.txt]
  has an xattr [user.mystream] with data too big (size=71157, maxsize=64k)

* FSArchiver will recreate the compressed files as uncompressed files: you will
  have to recompress files by hand from the explorer. It only affects the files
  which are transparently compressed by the NTFS filesystem. All the files
  which are compressed by an application will not be affected (zip, rar, jpg,
  ...). There is no data loss, so it's not a critical limitation.


Bootable partitions

If you are trying to save and restore partitions where Windows is installed,
you must be sure that the partition will still be active and that the boot.ini
will be consistent after you restore the ntfs partition. Also, the Windows
filesystem must be restored on a primary partition: it won't boot if it's
installed on a logical partition (inside an extended partition). The MBR has up
to four primary partition. Only one may be active. The MBR can only boot
Windows if the partition is marked as active. You can change this using tools
such as Parted or GParted.
If you have more than one partition on the hard disk, you have to check the
number of each partition. In general the partition number 1 is the first one on
the disk, but the situation may be different. The numbers associated with the
partition may not be in the expected order. You have to check that the number
of the partition where you restored the Windows filesystem match the number
which is written in boot.ini (boot.ini only exists in Windows 2000, 2003, XP).
To check it's correct and to edit boot.ini, you have to mount the ntfs
partition which has been restored. You have to used ntfs-3g to do that, and
then use an editor such as nano or vim to modify boot.ini.
In the following example, the partition where Windows is installed is partition
number 1 (/dev/sda1).

  # fsarchiver probe simple
  [=====DEVICE=====] [==FILESYS==] [=====LABEL=====] [====SIZE====] [MAJ] [MIN]
  [/dev/sda1       ] [ntfs       ] [winxp32        ] [    16.00 GB] [  8] [  1]
  [/dev/sda2       ] [ext3       ] [boot           ] [   976.55 MB] [  8] [  2]
  [/dev/sda3       ] [reiserfs   ] [gentoo         ] [    16.00 GB] [  8] [  3]
  [/dev/sda4       ] [lvm2pv     ] [<unknown>      ] [   898.56 GB] [  8] [  4]

We can mount this partition from SystemRescueCd using ntfs-3g:

  # ntfs-3g /dev/sda1 /mnt/windows

And then we check that the boot partition is set to partition 1 in boot.ini:

  # cat /mnt/windows/boot.ini
  [boot loader]
  timeout=1
  default=multi(0)disk(0)rdisk(0)partition(1)\windows
  [operating systems]
  multi(0)disk(0)rdisk(0)partition(1)\windows="Microsoft Windows XP" /noexecute=optin /fastdetect

If we want to edit this file, we can use and editor such as nano or vim:

  # nano /mnt/windows/boot.ini

After these changes, we have to unmount the partition:

  # umount /mnt/windows