0% found this document useful (0 votes)
6 views1 page

Clone File System Rsync Sy

This document provides instructions for cloning a file system hierarchy from one disk to another using the rsync command, emphasizing the importance of including a final slash in the source path. It also details necessary post-cloning steps, such as updating the /etc/fstab file with new UUIDs and restoring Grub using boot-repair. Additionally, it advises against copying virtual pseudo file systems and the swap partition during the cloning process.

Uploaded by

jaime
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Clone File System Rsync Sy

This document provides instructions for cloning a file system hierarchy from one disk to another using the rsync command, emphasizing the importance of including a final slash in the source path. It also details necessary post-cloning steps, such as updating the /etc/fstab file with new UUIDs and restoring Grub using boot-repair. Additionally, it advises against copying virtual pseudo file systems and the swap partition during the cloning process.

Uploaded by

jaime
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Clone File System HierClone File System Hierarchy to Another Disk With Rsyncarchy

to Another Disk With Rsync

Supposing that /mnt/sourcePart is the mount point of the partition to be cloned,


and /mnt/destPart that of the target partition, let’s proceed with the cloning.
Note that this operation requires root permissions:

rsync -axHAWXS --numeric-ids --info=progress2 /mnt/sourcePart/ /mnt/destPart

Let’s be careful to include the final slash in /mnt/sourcePart/. Otherwise, rsync


will copy the parent directory instead of that directory’s content.

In detail:

-a is the archive mode: it recurses into directories, copies symlinks as symlinks,


and preserves permissions, owner, group, modification times, device files, and
special files.
-x doesn’t cross filesystem boundaries.
-H preserves hard links.
-A preserves ACLs.
-W disables the delta-transfer algorithm used to reduce network usage. It’s a
convenient way to boost speed when both the source and destination are local paths.
-X updates the destination extended attributes to be the same as the source ones.
-S tries to handle sparse files efficiently so that they take up less space on the
destination.
–numeric-ids uses numeric IDs instead of trying to map them. It’s notably needed
for backups of jailed systems (BSD jails, OpenVZ, VServer, LXC) that appear to have
bogus IDs when seen from their host system because they have their own ID maps.
–info=progress2 outputs statistics based on the whole transfer, rather than
individual files.

Fixing /etc/fstab
The /etc/fstab file typically lists all available disk partitions to be
automatically mounted at boot time. After the cloning, we have to manually edit
/etc/fstab to update the partitions’ UUIDs, which we can get using GParted or
blkid. Generally, this is sufficient unless we need to add or remove partitions
from the list, or change the file system types, to match the new configuration.

Let’s remember that the boot partition must have the boot flag. If it’s missing, we
can add it with GParted.

Restoring Grub
Whatever the operating systems we cloned, the easiest way to restore Grub is boot-
repair, a graphical tool available on live CDs/DVDs. It’s a one-click approach that
works fine. We have just to click on the “Recommended repair” button. If the repair
is unsuccessful, the software provides a detailed log and instructions for asking
for help.

After the restore, we may want to change the default options, like removing the
“quiet splash” options that are not useful in a server environment. We can manually
edit the /etc/default/grub file in this case. After that, let’s remember to run
update-grub to save the changes permanently.

Avoid copying virtual pseudo file systems (/dev, /proc, and /sys). Cloning the swap
partition or the swap file is always superfluous.

You might also like