Este conteúdo não está disponível no idioma selecionado.
3.7. Backing Up and Restoring XFS File Systems
XFS file system backup and restoration involve these utilities:
- xfsdump for creating the backup
- xfsrestore for restoring from backup
3.7.1. Features of XFS Backup and Restoration Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Backup Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
You can use the
xfsdump utility to:
- Perform backups to regular file images.Only one backup can be written to a regular file.
- Perform backups to tape drives.The
xfsdumputility also allows you to write multiple backups to the same tape. A backup can span multiple tapes.To back up multiple file systems to a single tape device, simply write the backup to a tape that already contains an XFS backup. This appends the new backup to the previous one. By default,xfsdumpnever overwrites existing backups. - Create incremental backups.The
xfsdumputility uses dump levels to determine a base backup to which other backups are relative. Numbers from0to9refer to increasing dump levels. An incremental backup only backs up files that have changed since the last dump of a lower level:- To perform a full backup, perform a level 0 dump on the file system.
- A level 1 dump is the first incremental backup after a full backup. The next incremental backup would be level 2, which only backs up files that have changed since the last level 1 dump; and so on, to a maximum of level 9.
- Exclude files from a backup using size, subtree, or inode flags to filter them.
Restoration Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
The xfsrestore utility restores file systems from backups produced by xfsdump. The xfsrestore utility has two modes:
A unique session ID or session label identifies each backup. Restoring a backup from a tape containing multiple backups requires its corresponding session ID or label.
To extract, add, or delete specific files from a backup, enter the
xfsrestore interactive mode. The interactive mode provides a set of commands to manipulate the backup files.
3.7.2. Backing Up an XFS File System Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This procedure describes how to back up the content of an XFS file system into a file or a tape.
Procedure 3.1. Backing Up an XFS File System
- Use the following command to back up an XFS file system:
xfsdump -l level [-L label] -f backup-destination path-to-xfs-filesystem
# xfsdump -l level [-L label] -f backup-destination path-to-xfs-filesystemCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace level with the dump level of your backup. Use
0to perform a full backup or1to9to perform consequent incremental backups. - Replace backup-destination with the path where you want to store your backup. The destination can be a regular file, a tape drive, or a remote tape device. For example,
/backup-files/Data.xfsdumpfor a file or/dev/st0for a tape drive. - Replace path-to-xfs-filesystem with the mount point of the XFS file system you want to back up. For example,
/mnt/data/. The file system must be mounted. - When backing up multiple file systems and saving them on a single tape device, add a session label to each backup using the
-L labeloption so that it is easier to identify them when restoring. Replace label with any name for your backup: for example,backup_data.
Example 3.4. Backing up Multiple XFS File Systems
- To back up the content of XFS file systems mounted on the
/boot/and/data/directories and save them as files in the/backup-files/directory:xfsdump -l 0 -f /backup-files/boot.xfsdump /boot xfsdump -l 0 -f /backup-files/data.xfsdump /data
# xfsdump -l 0 -f /backup-files/boot.xfsdump /boot # xfsdump -l 0 -f /backup-files/data.xfsdump /dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To back up multiple file systems on a single tape device, add a session label to each backup using the
-L labeloption:xfsdump -l 0 -L "backup_boot" -f /dev/st0 /boot xfsdump -l 0 -L "backup_data" -f /dev/st0 /data
# xfsdump -l 0 -L "backup_boot" -f /dev/st0 /boot # xfsdump -l 0 -L "backup_data" -f /dev/st0 /dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional Resources
- For more information about backing up XFS file systems, see the xfsdump(8) man page.
3.7.3. Restoring an XFS File System from Backup Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
This procedure describes how to restore the content of an XFS file system from a file or tape backup.
Prerequisites
- You need a file or tape backup of XFS file systems, as described in Section 3.7.2, “Backing Up an XFS File System”.
Procedure 3.2. Restoring an XFS File System from Backup
- The command to restore the backup varies depending on whether you are restoring from a full backup or an incremental one, or are restoring multiple backups from a single tape device:
xfsrestore [-r] [-S session-id] [-L session-label] [-i]
# xfsrestore [-r] [-S session-id] [-L session-label] [-i] -f backup-location restoration-pathCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Replace backup-location with the location of the backup. This can be a regular file, a tape drive, or a remote tape device. For example,
/backup-files/Data.xfsdumpfor a file or/dev/st0for a tape drive. - Replace restoration-path with the path to the directory where you want to restore the file system. For example,
/mnt/data/. - To restore a file system from an incremental (level 1 to level 9) backup, add the
-roption. - To restore a backup from a tape device that contains multiple backups, specify the backup using the
-Sor-Loptions.The-Slets you choose a backup by its session ID, while the-Llets you choose by the session label. To obtain the session ID and session labels, use thexfsrestore -Icommand.Replace session-id with the session ID of the backup. For example,b74a3586-e52e-4a4a-8775-c3334fa8ea2c. Replace session-label with the session label of the backup. For example,my_backup_session_label. - To use
xfsrestoreinteractively, use the-ioption.The interactive dialog begins afterxfsrestorefinishes reading the specified device. Available commands in the interactivexfsrestoreshell includecd,ls,add,delete, andextract; for a complete list of commands, use thehelpcommand.
Example 3.5. Restoring Multiple XFS File Systems
To restore the XFS backup files and save their content into directories under
/mnt/:
xfsrestore -f /backup-files/boot.xfsdump /mnt/boot/ xfsrestore -f /backup-files/data.xfsdump /mnt/data/
# xfsrestore -f /backup-files/boot.xfsdump /mnt/boot/
# xfsrestore -f /backup-files/data.xfsdump /mnt/data/
To restore from a tape device containing multiple backups, specify each backup by its session label or session ID:
xfsrestore -f /dev/st0 -L "backup_boot" /mnt/boot/ xfsrestore -f /dev/st0 -S "45e9af35-efd2-4244-87bc-4762e476cbab" /mnt/data/
# xfsrestore -f /dev/st0 -L "backup_boot" /mnt/boot/
# xfsrestore -f /dev/st0 -S "45e9af35-efd2-4244-87bc-4762e476cbab" /mnt/data/
Informational Messages When Restoring a Backup from a Tape
When restoring a backup from a tape with backups from multiple file systems, the
xfsrestore utility might issue messages. The messages inform you whether a match of the requested backup has been found when xfsrestore examines each backup on the tape in sequential order. For example:
The informational messages keep appearing until the matching backup is found.
Additional Resources
- For more information about restoring XFS file systems, see the xfsrestore(8) man page.