X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=BackupAndRestore.xml;h=8e8fcf86a636d6034c8d9dda98ceff233fd59b2e;hb=00c99af814574fe85ae7bea886d9fffcce4d0261;hp=1b557f5b670446ec76d355f29585cbb1b2f31266;hpb=d20446f6e1ede7f3a23e27c3bd195275e91a3cc9;p=doc%2Fmanual.git diff --git a/BackupAndRestore.xml b/BackupAndRestore.xml index 1b557f5..8e8fcf8 100644 --- a/BackupAndRestore.xml +++ b/BackupAndRestore.xml @@ -1,143 +1,319 @@ - - - Backing Up and Restoring a File System - This chapter describes how to backup and restore on Lustre, at the file system-level, - device-level and file-level. Each backup approach is described in the the following - sections: + + + Backing Up and Restoring a File + System + This chapter describes how to backup and restore at the file + system-level, device-level and file-level in a Lustre file system. Each + backup approach is described in the the following sections: - + + + - + + + - + + + - + + + - + + + -
- - <indexterm><primary>backup</primary></indexterm> - <indexterm><primary>restoring</primary><see>backup</see></indexterm> - <indexterm><primary>LVM</primary><see>backup</see></indexterm> - <indexterm><primary>rsync</primary><see>backup</see></indexterm> - Backing up a File System - Backing up a complete file system gives you full control over the files to back up, and - allows restoration of individual files as needed. File system-level backups are also the - easiest to integrate into existing backup solutions. - File system backups are performed from a Lustre client (or many clients working parallel in different directories) rather than on individual server nodes; this is no different than backing up any other file system. - However, due to the large size of most Lustre file systems, it is not always possible to get a complete backup. We recommend that you back up subsets of a file system. This includes subdirectories of the entire file system, filesets for a single user, files incremented by date, and so on. + It is strongly recommended that sites perform + periodic device-level backup of the MDT(s) + (), + for example twice a week with alternate backups going to a separate + device, even if there is not enough capacity to do a full backup of all + of the filesystem data. Even if there are separate file-level backups of + some or all files in the filesystem, having a device-level backup of the + MDT can be very useful in case of MDT failure or corruption. Being able to + restore a device-level MDT backup can avoid the significantly longer process + of restoring the entire filesystem from backup. Since the MDT is required + for access to all files, its loss would otherwise force full restore of the + filesystem (if that is even possible) even if the OSTs are still OK. + Performing a periodic device-level MDT backup can be done relatively + inexpensively because the storage need only be connected to the primary + MDS (it can be manually connected to the backup MDS in the rare case + it is needed), and only needs good linear read/write performance. While + the device-level MDT backup is not useful for restoring individual files, + it is most efficient to handle the case of MDT failure or corruption. +
+ + <indexterm> + <primary>backup</primary> + </indexterm> + <indexterm> + <primary>restoring</primary> + <see>backup</see> + </indexterm> + <indexterm> + <primary>LVM</primary> + <see>backup</see> + </indexterm> + <indexterm> + <primary>rsync</primary> + <see>backup</see> + </indexterm>Backing up a File System + Backing up a complete file system gives you full control over the + files to back up, and allows restoration of individual files as needed. + File system-level backups are also the easiest to integrate into existing + backup solutions. + File system backups are performed from a Lustre client (or many + clients working parallel in different directories) rather than on + individual server nodes; this is no different than backing up any other + file system. + However, due to the large size of most Lustre file systems, it is + not always possible to get a complete backup. We recommend that you back + up subsets of a file system. This includes subdirectories of the entire + file system, filesets for a single user, files incremented by date, and + so on, so that restores can be done more efficiently. - In order to allow Lustre to scale the file system namespace for future applications, - Lustre 2.x internally uses a 128-bit file identifier for all files. To interface with user - applications, Lustre presents 64-bit inode numbers for the stat(), - fstat(), and readdir() system calls on 64-bit - applications, and 32-bit inode numbers to 32-bit applications. - Some 32-bit applications accessing Lustre filesystems (on both 32-bit and 64-bit CPUs) may experience problems with the stat(), fstat() or readdir() system calls under certain circumstances, though the Lustre client should return 32-bit inode numbers to these applications. - In particular, if the Lustre file system is exported from a 64-bit client via NFS to a - 32-bit client, the Linux NFS server will export 64-bit inode numbers to applications running - on the NFS client. If the 32-bit applications are not compiled with Large File Support - (LFS), then they return EOVERFLOW errors when accessing the Lustre files. - To avoid this problem, Linux NFS clients can use the kernel command-line option - "nfs.enable_ino64=0" in order to force the NFS client to - export 32-bit inode numbers to the client. - Workaround: We very strongly recommend that backups using tar(1) and other utilities that depend on the inode number to uniquely identify an inode to be run on 64-bit clients. The 128-bit Lustre file identifiers cannot be uniquely mapped to a 32-bit inode number, and as a result these utilities may operate incorrectly on 32-bit clients. + Lustre internally uses a 128-bit file identifier (FID) for all + files. To interface with user applications, the 64-bit inode numbers + are returned by the stat(), + fstat(), and + readdir() system calls on 64-bit applications, and + 32-bit inode numbers to 32-bit applications. + Some 32-bit applications accessing Lustre file systems (on both + 32-bit and 64-bit CPUs) may experience problems with the + stat(), + fstat() or + readdir() system calls under certain circumstances, + though the Lustre client should return 32-bit inode numbers to these + applications. + In particular, if the Lustre file system is exported from a 64-bit + client via NFS to a 32-bit client, the Linux NFS server will export + 64-bit inode numbers to applications running on the NFS client. If the + 32-bit applications are not compiled with Large File Support (LFS), then + they return + EOVERFLOW errors when accessing the Lustre files. To + avoid this problem, Linux NFS clients can use the kernel command-line + option "nfs.enable_ino64=0" in order to force the + NFS client to export 32-bit inode numbers to the client. + + Workaround: We very strongly recommend + that backups using + tar(1) and other utilities that depend on the inode + number to uniquely identify an inode to be run on 64-bit clients. The + 128-bit Lustre file identifiers cannot be uniquely mapped to a 32-bit + inode number, and as a result these utilities may operate incorrectly on + 32-bit clients. While there is still a small chance of inode number + collisions with 64-bit inodes, the FID allocation pattern is designed + to avoid collisions for long periods of usage.
- <indexterm><primary>backup</primary><secondary>rsync</secondary></indexterm>Lustre_rsync - The lustre_rsync feature keeps the entire file system in sync on a backup by replicating the file system's changes to a second file system (the second file system need not be a Lustre file system, but it must be sufficiently large). lustre_rsync uses Lustre changelogs to efficiently synchronize the file systems without having to scan (directory walk) the Lustre file system. This efficiency is critically important for large file systems, and distinguishes the Lustre lustre_rsync feature from other replication/backup solutions. + + <indexterm> + <primary>backup</primary> + <secondary>rsync</secondary> + </indexterm>Lustre_rsync + The + lustre_rsync feature keeps the entire file system in + sync on a backup by replicating the file system's changes to a second + file system (the second file system need not be a Lustre file system, but + it must be sufficiently large). + lustre_rsync uses Lustre changelogs to efficiently + synchronize the file systems without having to scan (directory walk) the + Lustre file system. This efficiency is critically important for large + file systems, and distinguishes the Lustre + lustre_rsync feature from other replication/backup + solutions.
- <indexterm><primary>backup</primary><secondary>rsync</secondary><tertiary>using</tertiary></indexterm>Using Lustre_rsync - The lustre_rsync feature works by periodically running lustre_rsync, a userspace program used to synchronize changes in the Lustre file system onto the target file system. The lustre_rsync utility keeps a status file, which enables it to be safely interrupted and restarted without losing synchronization between the file systems. - The first time that lustre_rsync is run, the user must specify a set of parameters for the program to use. These parameters are described in the following table and in . On subsequent runs, these parameters are stored in the the status file, and only the name of the status file needs to be passed to lustre_rsync. - Before using lustre_rsync: + + <indexterm> + <primary>backup</primary> + <secondary>rsync</secondary> + <tertiary>using</tertiary> + </indexterm>Using Lustre_rsync + The + lustre_rsync feature works by periodically running + lustre_rsync, a userspace program used to + synchronize changes in the Lustre file system onto the target file + system. The + lustre_rsync utility keeps a status file, which + enables it to be safely interrupted and restarted without losing + synchronization between the file systems. + The first time that + lustre_rsync is run, the user must specify a set of + parameters for the program to use. These parameters are described in + the following table and in + . On subsequent runs, these + parameters are stored in the the status file, and only the name of the + status file needs to be passed to + lustre_rsync. + Before using + lustre_rsync: - Register the changelog user. For details, see the (changelog_register) parameter in the (lctl). + Register the changelog user. For details, see the + ( + changelog_register) parameter in the + ( + lctl). - AND - - Verify that the Lustre file system (source) and the replica file system (target) are identical before registering the changelog user. If the file systems are discrepant, use a utility, e.g. regular rsync (not lustre_rsync), to make them identical. + Verify that the Lustre file system (source) and the replica + file system (target) are identical + before registering the changelog user. If the + file systems are discrepant, use a utility, e.g. regular + rsync(not + lustre_rsync), to make them identical. - The lustre_rsync utility uses the following parameters: + The + lustre_rsync utility uses the following + parameters: - - + + - Parameter + + Parameter + - Description + + Description + - --source=src + + --source= + src + - The path to the root of the Lustre file system (source) which will be synchronized. This is a mandatory option if a valid status log created during a previous synchronization operation (--statuslog) is not specified. + The path to the root of the Lustre file system (source) + which will be synchronized. This is a mandatory option if a + valid status log created during a previous synchronization + operation ( + --statuslog) is not specified. - --target=tgt + + --target= + tgt + - The path to the root where the source file system will be synchronized (target). This is a mandatory option if the status log created during a previous synchronization operation (--statuslog) is not specified. This option can be repeated if multiple synchronization targets are desired. + The path to the root where the source file system will + be synchronized (target). This is a mandatory option if the + status log created during a previous synchronization + operation ( + --statuslog) is not specified. This option + can be repeated if multiple synchronization targets are + desired. - --mdt=mdt + + --mdt= + mdt + - The metadata device to be synchronized. A changelog user must be registered for this device. This is a mandatory option if a valid status log created during a previous synchronization operation (--statuslog) is not specified. + The metadata device to be synchronized. A changelog + user must be registered for this device. This is a mandatory + option if a valid status log created during a previous + synchronization operation ( + --statuslog) is not specified. - --user=userid + + --user= + userid + - The changelog user ID for the specified MDT. To use lustre_rsync, the changelog user must be registered. For details, see the changelog_register parameter in (lctl). This is a mandatory option if a valid status log created during a previous synchronization operation (--statuslog) is not specified. + The changelog user ID for the specified MDT. To use + lustre_rsync, the changelog user must be + registered. For details, see the + changelog_register parameter in + ( + lctl). This is a mandatory option if a + valid status log created during a previous synchronization + operation ( + --statuslog) is not specified. - --statuslog=log + + --statuslog= + log + - A log file to which synchronization status is saved. When the lustre_rsync utility starts, if the status log from a previous synchronization operation is specified, then the state is read from the log and otherwise mandatory --source, --target and --mdt options can be skipped. Specifying the --source, --target and/or --mdt options, in addition to the --statuslog option, causes the specified parameters in the status log to be overridden. Command line options take precedence over options in the status log. + A log file to which synchronization status is saved. + When the + lustre_rsync utility starts, if the status + log from a previous synchronization operation is specified, + then the state is read from the log and otherwise mandatory + --source, + --target and + --mdt options can be skipped. Specifying + the + --source, + --target and/or + --mdt options, in addition to the + --statuslog option, causes the specified + parameters in the status log to be overridden. Command line + options take precedence over options in the status + log. - --xattr yes|no + --xattr + yes|no - Specifies whether extended attributes (xattrs) are synchronized or not. The default is to synchronize extended attributes. - - Disabling xattrs causes Lustre striping information not to be synchronized. - + Specifies whether extended attributes ( + xattrs) are synchronized or not. The + default is to synchronize extended attributes. + + + Disabling xattrs causes Lustre striping information + not to be synchronized. + + - --verbose + + --verbose + Produces verbose output. @@ -145,18 +321,28 @@ - --dry-run + + --dry-run + - Shows the output of lustre_rsync commands (copy, mkdir, etc.) on the target file system without actually executing them. + Shows the output of + lustre_rsync commands ( + copy, + mkdir, etc.) on the target file system + without actually executing them. - --abort-on-err + + --abort-on-err + - Stops processing the lustre_rsync operation if an error occurs. The default is to continue the operation. + Stops processing the + lustre_rsync operation if an error occurs. + The default is to continue the operation. @@ -164,16 +350,26 @@
- <indexterm><primary>backup</primary><secondary>rsync</secondary><tertiary>examples</tertiary></indexterm><literal>lustre_rsync</literal> Examples - Sample lustre_rsync commands are listed below. - Register a changelog user for an MDT (e.g. lustre-MDT0000). - # lctl --device lustre-MDT0000 changelog_register lustre-MDT0000 -Registered changelog userid 'cl1' - Synchronize a Lustre file system (/mnt/lustre) to a target file system (/mnt/target). + + <indexterm> + <primary>backup</primary> + <secondary>rsync</secondary> + <tertiary>examples</tertiary> + </indexterm> + <literal>lustre_rsync</literal> Examples + Sample + lustre_rsync commands are listed below. + Register a changelog user for an MDT (e.g. + testfs-MDT0000). + # lctl --device testfs-MDT0000 changelog_register testfs-MDT0000 +Registered changelog userid 'cl1' + Synchronize a Lustre file system ( + /mnt/lustre) to a target file system ( + /mnt/target). $ lustre_rsync --source=/mnt/lustre --target=/mnt/target \ - --mdt=lustre-MDT0000 --user=cl1 --statuslog sync.log --verbose -Lustre filesystem: lustre -MDT device: lustre-MDT0000 + --mdt=testfs-MDT0000 --user=cl1 --statuslog sync.log --verbose +Lustre filesystem: testfs +MDT device: testfs-MDT0000 Source: /mnt/lustre Target: /mnt/target Statuslog: sync.log @@ -182,10 +378,13 @@ Starting changelog record: 0 Errors: 0 lustre_rsync took 1 seconds Changelog records consumed: 22 - After the file system undergoes changes, synchronize the changes onto the target file system. Only the statuslog name needs to be specified, as it has all the parameters passed earlier. + After the file system undergoes changes, synchronize the changes + onto the target file system. Only the + statuslog name needs to be specified, as it has all + the parameters passed earlier. $ lustre_rsync --statuslog sync.log --verbose -Replicating Lustre filesystem: lustre -MDT device: lustre-MDT0000 +Replicating Lustre filesystem: testfs +MDT device: testfs-MDT0000 Source: /mnt/lustre Target: /mnt/target Statuslog: sync.log @@ -194,134 +393,302 @@ Starting changelog record: 22 Errors: 0 lustre_rsync took 2 seconds Changelog records consumed: 42 - To synchronize a Lustre file system (/mnt/lustre) to two target file systems (/mnt/target1 and /mnt/target2). + To synchronize a Lustre file system ( + /mnt/lustre) to two target file systems ( + /mnt/target1 and + /mnt/target2). $ lustre_rsync --source=/mnt/lustre --target=/mnt/target1 \ - --target=/mnt/target2 --mdt=lustre-MDT0000 --user=cl1 \ + --target=/mnt/target2 --mdt=testfs-MDT0000 --user=cl1 \ --statuslog sync.log
-
- <indexterm><primary>backup</primary><secondary>MDS/OST device level</secondary></indexterm>Backing Up and Restoring an MDS or OST (Device Level) - In some cases, it is useful to do a full device-level backup of an individual device (MDT or OST), before replacing hardware, performing maintenance, etc. Doing full device-level backups ensures that all of the data and configuration files is preserved in the original state and is the easiest method of doing a backup. For the MDT file system, it may also be the fastest way to perform the backup and restore, since it can do large streaming read and write operations at the maximum bandwidth of the underlying devices. +
+ + <indexterm> + <primary>backup</primary> + <secondary>MDT/OST device level</secondary> + </indexterm>Backing Up and Restoring an MDT or OST (ldiskfs Device Level) + In some cases, it is useful to do a full device-level backup of an + individual device (MDT or OST), before replacing hardware, performing + maintenance, etc. Doing full device-level backups ensures that all of the + data and configuration files is preserved in the original state and is the + easiest method of doing a backup. For the MDT file system, it may also be + the fastest way to perform the backup and restore, since it can do large + streaming read and write operations at the maximum bandwidth of the + underlying devices. - Keeping an updated full backup of the MDT is especially important because a permanent failure of the MDT file system renders the much larger amount of data in all the OSTs largely inaccessible and unusable. + Keeping an updated full backup of the MDT is especially important + because permanent failure or corruption of the MDT file system renders + the much larger amount of data in all the OSTs largely inaccessible and + unusable. The storage needed for one or two full MDT device backups + is much smaller than doing a full filesystem backup, and can use less + expensive storage than the actual MDT device(s) since it only needs to + have good streaming read/write speed instead of high random IOPS. - - In Lustre 2.0 through 2.2, the only successful way to backup and - restore an MDT is to do a device-level backup as is described in this - section. File-level restore of an MDT is not possible before Lustre 2.3, - as the Object Index (OI) file cannot be rebuilt after restore without - the OI Scrub functionality. - Since Lustre 2.3, Object Index files - are automatically rebuilt at first mount after a restore is detected - (see LU-957), - and file-level backup is supported - (see ). - - If hardware replacement is the reason for the backup or if a spare storage device is available, it is possible to do a raw copy of the MDT or OST from one block device to the other, as long as the new device is at least as large as the original device. To do this, run: - dd if=/dev/{original} of=/dev/{newdev} bs=1M - If hardware errors cause read problems on the original device, use the command below to allow as much data as possible to be read from the original device while skipping sections of the disk with errors: + If hardware replacement is the reason for the backup or if a spare + storage device is available, it is possible to do a raw copy of the MDT or + OST from one block device to the other, as long as the new device is at + least as large as the original device. To do this, run: + dd if=/dev/{original} of=/dev/{newdev} bs=4M + If hardware errors cause read problems on the original device, use + the command below to allow as much data as possible to be read from the + original device while skipping sections of the disk with errors: dd if=/dev/{original} of=/dev/{newdev} bs=4k conv=sync,noerror / count={original size in 4kB blocks} Even in the face of hardware errors, the ldiskfs - file system is very robust and it may be possible to recover the file - system data after running e2fsck -fy /dev/{newdev} on - the new device, along with ll_recover_lost_found_objs - for OST devices. + file system is very robust and it may be possible + to recover the file system data after running + e2fsck -fy /dev/{newdev} on the new device. + With Lustre software version 2.6 and later, the + LFSCK scanning will automatically move objects from + lost+found back into its correct location on the OST + after directory corruption. + In order to ensure that the backup is fully consistent, the MDT or + OST must be unmounted, so that there are no changes being made to the + device while the data is being transferred. If the reason for the + backup is preventative (i.e. MDT backup on a running MDS in case of + future failures) then it is possible to perform a consistent backup from + an LVM snapshot. If an LVM snapshot is not available, and taking the + MDS offline for a backup is unacceptable, it is also possible to perform + a backup from the raw MDT block device. While the backup from the raw + device will not be fully consistent due to ongoing changes, the vast + majority of ldiskfs metadata is statically allocated, and inconsistencies + in the backup can be fixed by running e2fsck on the + backup device, and is still much better than not having any backup at all. +
-
- <indexterm><primary>backup</primary><secondary>OST file system</secondary></indexterm><indexterm><primary>backup</primary><secondary>MDT file system</secondary></indexterm>Making a File-Level Backup of an OST or MDT File System - This procedure provides an alternative to backup or migrate the data of an OST or MDT at the file level. At the file-level, unused space is omitted from the backed up and the process may be completed quicker with smaller total backup size. Backing up a single OST device is not necessarily the best way to perform backups of the Lustre file system, since the files stored in the backup are not usable without metadata stored on the MDT and additional file stripes that may be on other OSTs. However, it is the preferred method for migration of OST devices, especially when it is desirable to reformat the underlying file system with different configuration options or to reduce fragmentation. +
+ + <indexterm> + <primary>backup</primary> + <secondary>OST file system</secondary> + </indexterm> + <indexterm> + <primary>backup</primary> + <secondary>MDT file system</secondary> + </indexterm>Backing Up an OST or MDT (Backend File System Level) + This procedure provides an alternative to backup or migrate the data + of an OST or MDT at the file level. At the file-level, unused space is + omitted from the backup and the process may be completed quicker with a + smaller total backup size. Backing up a single OST device is not + necessarily the best way to perform backups of the Lustre file system, + since the files stored in the backup are not usable without metadata stored + on the MDT and additional file stripes that may be on other OSTs. However, + it is the preferred method for migration of OST devices, especially when it + is desirable to reformat the underlying file system with different + configuration options or to reduce fragmentation. - Prior to Lustre 2.3, the only successful way to perform an MDT - backup and restore is to do a device-level backup as is described in - . The ability to do MDT - file-level backups is not available for Lustre 2.0 thru 2.2, because - restoration of the Object Index (OI) file does not return the MDT to - a functioning state. Since Lustre 2.3, - Object Index files are automatically rebuilt at first mount after a - restore is detected (see - LU-957), - so file-level MDT restore is supported. + Since Lustre stores internal metadata that maps FIDs to local + inode numbers via the Object Index file, they need to be rebuilt at + first mount after a restore is detected so that file-level MDT backup + and restore is supported. The OI Scrub rebuilds these automatically + at first mount after a restore is detected, which may affect MDT + performance after mount until the rebuild is completed. Progress can + be monitored via lctl get_param osd-*.*.oi_scrub + on the MDS or OSS node where the target filesystem was restored. + - For Lustre 2.3 and newer with MDT file-level backup support, substitute mdt for ost in the instructions below. - - - Make a mountpoint for the file system. - [oss]# mkdir -p /mnt/ost - - - Mount the file system. +
+ + <indexterm> + <primary>backup</primary> + <secondary>index objects</secondary> + </indexterm>Backing Up an OST or MDT (Backend File System Level) + Prior to Lustre software release 2.11.0, we can only do the backend + file system level backup and restore process for ldiskfs-based systems. + The ability to perform a zfs-based MDT/OST file system level backup and + restore is introduced beginning in Lustre software release 2.11.0. + Differing from an ldiskfs-based system, index objects must be backed up + before the unmount of the target (MDT or OST) in order to be able to + restore the file system successfully. To enable index backup on the + target, execute the following command on the target server: + # lctl set_param osd-*.${fsname}-${target}.index_backup=1 + ${target} is composed of the target type + (MDT or OST) plus the target index, such as MDT0000, + OST0001, and so on. + The index_backup is also valid for an ldiskfs-based system, + that will be used when migrating data between ldiskfs-based and + zfs-based systems as described in . + +
+
+ + <indexterm> + <primary>backup</primary> + <secondary>OST and MDT</secondary> + </indexterm>Backing Up an OST or MDT + The below examples show backing up an OST filesystem. When backing + up an MDT, substitute mdt for ost + in the instructions below. + + + Umount the target + + + Make a mountpoint for the file system. + + [oss]# mkdir -p /mnt/ost + + + Mount the file system. + For ldiskfs-based systems: [oss]# mount -t ldiskfs /dev/{ostdev} /mnt/ost + For zfs-based systems: + + + Import the pool for the target if it is exported. For example: + [oss]# zpool import lustre-ost [-d ${ostdev_dir}] + + + + Enable the canmount property on the target + filesystem. For example: + [oss]# zfs set canmount=on ${fsname}-ost/ost + You also can specify the mountpoint property. By default, it will + be: /${fsname}-ost/ost + + + + Mount the target as 'zfs'. For example: + [oss]# zfs mount ${fsname}-ost/ost + + + - Change to the mountpoint being backed up. + + Change to the mountpoint being backed + up. + [oss]# cd /mnt/ost - Back up the extended attributes. - [oss]# getfattr -R -d -m '.*' -e hex -P . > ea-$(date +%Y%m%d).bak + + Back up the extended attributes. + + [oss]# getfattr -R -d -m '.*' -e hex -P . > ea-$(date +%Y%m%d).bak - If the tar(1) command supports the --xattr option, the getfattr step may be unnecessary as long as tar does a backup of the trusted.* attributes. However, completing this step is not harmful and can serve as an added safety measure. + If the tar(1) command supports the + --xattr option (see below), the + getfattr step may be unnecessary as long as tar + correctly backs up the trusted.* attributes. + However, completing this step is not harmful and can serve as an + added safety measure. - In most distributions, the getfattr command is part of the attr package. If the getfattr command returns errors like Operation not supported, then the kernel does not correctly support EAs. Stop and use a different backup method. + In most distributions, the + getfattr command is part of the + attr package. If the + getfattr command returns errors like + Operation not supported, then the kernel does not + correctly support EAs. Stop and use a different backup method. - Verify that the ea-$date.bak file has properly backed up the EA data on the OST. - Without this attribute data, the restore process may be missing extra data that can be very useful in case of later file system corruption. Look at this file with more or a text editor. Each object file should have a corresponding item similar to this: + + Verify that the + ea-$date.bak file has properly backed up the EA + data on the OST. + + Without this attribute data, the MDT restore process will fail + and result in an unusable filesystem. The OST restore process may be + missing extra data that can be very useful in case of later file system + corruption. Look at this file with more or a text + editor. Each object file should have a corresponding item similar to + this: [oss]# file: O/0/d0/100992 trusted.fid= \ 0x0d822200000000004a8a73e500000000808a0100000000000000000000000000 - Back up all file system data. - [oss]# tar czvf {backup file}.tgz [--xattrs] --sparse . + + Back up all file system data. + + [oss]# tar czvf {backup file}.tgz [--xattrs] [--xattrs-include="trusted.*" --sparse . - The tar --sparse option is vital for backing up an MDT. In - order to have --sparse behave correctly, and complete the backup of - and MDT in finite time, the version of tar must be specified. Correctly functioning - versions of tar include the Lustre software enhanced version of tar at , the tar from a Red Hat Enterprise Linux distribution (version 6.3 or more recent) - and the GNU tar version 1.25 or more recent. + The tar + --sparse option is vital for backing up an MDT. + Very old versions of tar may not support the + --sparse option correctly, which may cause the + MDT backup to take a long time. Known-working versions include + the tar from Red Hat Enterprise Linux distribution (RHEL version + 6.3 or newer) or GNU tar version 1.25 and newer. - The tar --xattrs option is only available - in GNU tar distributions from Red Hat or Intel. + The tar --xattrs option is only available + in GNU tar version 1.27 or later or in RHEL 6.3 or newer. The + --xattrs-include="trusted.*" option is + required for correct restoration of the xattrs + when using GNU tar 1.27 or RHEL 7 and newer. - Change directory out of the file system. + + Change directory out of the file + system. + [oss]# cd - - Unmount the file system. + + Unmount the file system. + [oss]# umount /mnt/ost - When restoring an OST backup on a different node as part of an OST migration, you also have to change server NIDs and use the --writeconf command to re-generate the configuration logs. See (Changing a Server NID). + When restoring an OST backup on a different node as part of an + OST migration, you also have to change server NIDs and use the + --writeconf command to re-generate the + configuration logs. See + (Changing a Server NID). +
-
- <indexterm><primary>backup</primary><secondary>restoring file system backup</secondary></indexterm>Restoring a File-Level Backup - To restore data from a file-level backup, you need to format the device, restore the file data and then restore the EA data. +
+ + <indexterm> + <primary>backup</primary> + <secondary>restoring file system backup</secondary> + </indexterm>Restoring a File-Level Backup + To restore data from a file-level backup, you need to format the + device, restore the file data and then restore the EA data. Format the new device. - [oss]# mkfs.lustre --ost --index {OST index} {other options} /dev/{newdev} + [oss]# mkfs.lustre --ost --index {OST index} +--replace --fstype=${fstype} {other options} /dev/{newdev} - Set the file system label. + Set the file system label (ldiskfs-based + systems only). [oss]# e2label {fsname}-OST{index in hex} /mnt/ost Mount the file system. + For ldiskfs-based systems: [oss]# mount -t ldiskfs /dev/{newdev} /mnt/ost + For zfs-based systems: + + + Import the pool for the target if it is exported. For example: + + [oss]# zpool import lustre-ost [-d ${ostdev_dir}] + + + Enable the canmount property on the target filesystem. For + example: + [oss]# zfs set canmount=on ${fsname}-ost/ost + You also can specify the mountpoint + property. By default, it will be: + /${fsname}-ost/ost + + + Mount the target as 'zfs'. For example: + [oss]# zfs mount ${fsname}-ost/ost + + Change to the new file system mount point. @@ -329,60 +696,148 @@ trusted.fid= \ Restore the file system backup. - [oss]# tar xzvpf {backup file} [--xattrs] --sparse + [oss]# tar xzvpf {backup file} [--xattrs] [--xattrs-include="trusted.*"] --sparse + + The tar --xattrs option is only available + in GNU tar version 1.27 or later or in RHEL 6.3 or newer. The + --xattrs-include="trusted.*" option is + required for correct restoration of the + MDT xattrs when using GNU tar 1.27 or RHEL 7 and newer. Otherwise, + the setfattr step below should be used. + + - Restore the file system extended attributes. + If not using a version of tar that supports direct xattr + backups, restore the file system extended attributes. [oss]# setfattr --restore=ea-${date}.bak - If --xattrs option is supported by tar and specified in the step above, this step is redundant. + If + --xattrs option is supported by tar and specified + in the step above, this step is redundant. Verify that the extended attributes were restored. - [oss]# getfattr -d -m ".*" -e hex O/0/d0/100992 trusted.fid= \ + [oss]# getfattr -d -m ".*" -e hex O/0/d0/100992 trusted.fid= \ 0x0d822200000000004a8a73e500000000808a0100000000000000000000000000 + Remove old OI and LFSCK files. + [oss]# rm -rf oi.16* lfsck_* LFSCK + + + Remove old CATALOGS. + [oss]# rm -f CATALOGS + + This is optional for the MDT side only. The CATALOGS record the + llog file handlers that are used for recovering cross-server updates. + Before OI scrub rebuilds the OI mappings for the llog files, the + related recovery will get a failure if it runs faster than the + background OI scrub. This will result in a failure of the whole mount + process. OI scrub is an online tool, therefore, a mount failure means + that the OI scrub will be stopped. Removing the old CATALOGS will + avoid this potential trouble. The side-effect of removing old + CATALOGS is that the recovery for related cross-server updates will + be aborted. However, this can be handled by LFSCK after the system + mount is up. + + + Change directory out of the file system. [oss]# cd - Unmount the new file system. [oss]# umount /mnt/ost + If the restored system has a different NID from the backup + system, please change the NID. For detail, please refer to + . For example: + [oss]# mount -t lustre -o nosvc ${fsname}-ost/ost /mnt/ost +[oss]# lctl replace_nids ${fsname}-OSTxxxx $new_nids +[oss]# umount /mnt/ost + + + Mount the target as lustre. + Usually, we will use the -o abort_recov option + to skip unnecessary recovery. For example: + [oss]# mount -t lustre -o abort_recov #{fsname}-ost/ost /mnt/ost + Lustre can detect the restore automatically when mounting the + target, and then trigger OI scrub to rebuild the OIs and index objects + asynchronously in the background. You can check the OI scrub status + with the following command: + [oss]# lctl get_param -n osd-${fstype}.${fsname}-${target}.oi_scrub - If the file system was used between the time the backup was made and when it was restored, then the lfsck tool (part of Lustre e2fsprogs) can optionally be run to ensure the file system is coherent. If all of the device file systems were backed up at the same time after the entire Lustre file system was stopped, this is not necessary. In either case, the file system should be immediately usable even if lfsck is not run, though there may be I/O errors reading from files that are present on the MDT but not the OSTs, and files that were created after the MDT backup will not be accessible/visible. + If the file system was used between the time the backup was made and + when it was restored, then the online LFSCK tool will + automatically be run to ensure the filesystem is coherent. If all of the + device filesystems were backed up at the same time after Lustre was + was stopped, this step is unnecessary. In either case, the filesystem + will be immediately although there may be I/O errors reading + from files that are present on the MDT but not the OSTs, and files that + were created after the MDT backup will not be accessible or visible. See + for details on using LFSCK.
-
- <indexterm><primary>backup</primary><secondary>using LVM</secondary></indexterm>Using LVM Snapshots with Lustre - If you want to perform disk-based backups (because, for example, access to the backup system needs to be as fast as to the primary Lustre file system), you can use the Linux LVM snapshot tool to maintain multiple, incremental file system backups. - Because LVM snapshots cost CPU cycles as new files are written, taking snapshots of the main Lustre file system will probably result in unacceptable performance losses. You should create a new, backup Lustre file system and periodically (e.g., nightly) back up new/changed files to it. Periodic snapshots can be taken of this backup file system to create a series of "full" backups. +
+ + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + </indexterm>Using LVM Snapshots with the Lustre File System + If you want to perform disk-based backups (because, for example, + access to the backup system needs to be as fast as to the primary Lustre + file system), you can use the Linux LVM snapshot tool to maintain multiple, + incremental file system backups. + Because LVM snapshots cost CPU cycles as new files are written, + taking snapshots of the main Lustre file system will probably result in + unacceptable performance losses. You should create a new, backup Lustre + file system and periodically (e.g., nightly) back up new/changed files to + it. Periodic snapshots can be taken of this backup file system to create a + series of "full" backups. - Creating an LVM snapshot is not as reliable as making a separate backup, because the LVM snapshot shares the same disks as the primary MDT device, and depends on the primary MDT device for much of its data. If the primary MDT device becomes corrupted, this may result in the snapshot being corrupted. + Creating an LVM snapshot is not as reliable as making a separate + backup, because the LVM snapshot shares the same disks as the primary MDT + device, and depends on the primary MDT device for much of its data. If + the primary MDT device becomes corrupted, this may result in the snapshot + being corrupted.
- <indexterm><primary>backup</primary><secondary>using LVM</secondary><tertiary>creating</tertiary></indexterm>Creating an LVM-based Backup File System - Use this procedure to create a backup Lustre file system for use with the LVM snapshot mechanism. + + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + <tertiary>creating</tertiary> + </indexterm>Creating an LVM-based Backup File System + Use this procedure to create a backup Lustre file system for use + with the LVM snapshot mechanism. Create LVM volumes for the MDT and OSTs. - Create LVM devices for your MDT and OST targets. Make sure not to use the entire disk for the targets; save some room for the snapshots. The snapshots start out as 0 size, but grow as you make changes to the current file system. If you expect to change 20% of the file system between backups, the most recent snapshot will be 20% of the target size, the next older one will be 40%, etc. Here is an example: + Create LVM devices for your MDT and OST targets. Make sure not + to use the entire disk for the targets; save some room for the + snapshots. The snapshots start out as 0 size, but grow as you make + changes to the current file system. If you expect to change 20% of + the file system between backups, the most recent snapshot will be 20% + of the target size, the next older one will be 40%, etc. Here is an + example: cfs21:~# pvcreate /dev/sda1 - Physical volume "/dev/sda1" successfully created + Physical volume "/dev/sda1" successfully created cfs21:~# vgcreate vgmain /dev/sda1 - Volume group "vgmain" successfully created + Volume group "vgmain" successfully created cfs21:~# lvcreate -L200G -nMDT0 vgmain - Logical volume "MDT0" created + Logical volume "MDT0" created cfs21:~# lvcreate -L200G -nOST0 vgmain - Logical volume "OST0" created + Logical volume "OST0" created cfs21:~# lvscan - ACTIVE '/dev/vgmain/MDT0' [200.00 GB] inherit - ACTIVE '/dev/vgmain/OST0' [200.00 GB] inherit + ACTIVE '/dev/vgmain/MDT0' [200.00 GB] inherit + ACTIVE '/dev/vgmain/OST0' [200.00 GB] inherit Format the LVM volumes as Lustre targets. - In this example, the backup file system is called 'main' and designates the current, most up-to-date backup. + In this example, the backup file system is called + main and designates the current, most up-to-date + backup. cfs21:~# mkfs.lustre --fsname=main --mdt --index=0 /dev/vgmain/MDT0 No management node specified, adding MGS to this MDT. Permanent disk data: @@ -403,7 +858,8 @@ checking for existing Lustre data mkfs_cmd = mkfs.ext2 -j -b 4096 -L main-MDT0000 -i 4096 -I 512 -q -O dir_index -F /dev/vgmain/MDT0 Writing CONFIGS/mountdata -cfs21:~# mkfs.lustre --mgsnode=cfs21 --fsname=main --ost --index=0 /dev/vgmain/OST0 +cfs21:~# mkfs.lustre --mgsnode=cfs21 --fsname=main --ost --index=0 +/dev/vgmain/OST0 Permanent disk data: Target: main-OST0000 Index: 0 @@ -425,13 +881,20 @@ checking for existing Lustre data Writing CONFIGS/mountdata cfs21:~# mount -t lustre /dev/vgmain/MDT0 /mnt/mdt cfs21:~# mount -t lustre /dev/vgmain/OST0 /mnt/ost -cfs21:~# mount -t lustre cfs21:/main /mnt/main +cfs21:~# mount -t lustre cfs21:/main /mnt/main +
- <indexterm><primary>backup</primary><secondary>new/changed files</secondary></indexterm>Backing up New/Changed Files to the Backup File System - At periodic intervals e.g., nightly, back up new and changed files to the LVM-based backup file system. + + <indexterm> + <primary>backup</primary> + <secondary>new/changed files</secondary> + </indexterm>Backing up New/Changed Files to the Backup File + System + At periodic intervals e.g., nightly, back up new and changed files + to the LVM-based backup file system. cfs21:~# cp /etc/passwd /mnt/main cfs21:~# cp /etc/fstab /mnt/main @@ -440,29 +903,60 @@ cfs21:~# ls /mnt/main fstab passwd
- <indexterm><primary>backup</primary><secondary>using LVM</secondary><tertiary>creating snapshots</tertiary></indexterm>Creating Snapshot Volumes - Whenever you want to make a "checkpoint" of the main Lustre file system, create LVM snapshots of all target MDT and OSTs in the LVM-based backup file system. You must decide the maximum size of a snapshot ahead of time, although you can dynamically change this later. The size of a daily snapshot is dependent on the amount of data changed daily in the main Lustre file system. It is likely that a two-day old snapshot will be twice as big as a one-day old snapshot. - You can create as many snapshots as you have room for in the volume group. If necessary, you can dynamically add disks to the volume group. - The snapshots of the target MDT and OSTs should be taken at the same point in time. Make sure that the cronjob updating the backup file system is not running, since that is the only thing writing to the disks. Here is an example: + + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + <tertiary>creating snapshots</tertiary> + </indexterm>Creating Snapshot Volumes + Whenever you want to make a "checkpoint" of the main Lustre file + system, create LVM snapshots of all target MDT and OSTs in the LVM-based + backup file system. You must decide the maximum size of a snapshot ahead + of time, although you can dynamically change this later. The size of a + daily snapshot is dependent on the amount of data changed daily in the + main Lustre file system. It is likely that a two-day old snapshot will be + twice as big as a one-day old snapshot. + You can create as many snapshots as you have room for in the volume + group. If necessary, you can dynamically add disks to the volume + group. + The snapshots of the target MDT and OSTs should be taken at the + same point in time. Make sure that the cronjob updating the backup file + system is not running, since that is the only thing writing to the disks. + Here is an example: cfs21:~# modprobe dm-snapshot cfs21:~# lvcreate -L50M -s -n MDT0.b1 /dev/vgmain/MDT0 Rounding up size to full physical extent 52.00 MB - Logical volume "MDT0.b1" created + Logical volume "MDT0.b1" created cfs21:~# lvcreate -L50M -s -n OST0.b1 /dev/vgmain/OST0 Rounding up size to full physical extent 52.00 MB - Logical volume "OST0.b1" created - After the snapshots are taken, you can continue to back up new/changed files to "main". The snapshots will not contain the new files. + Logical volume "OST0.b1" created + + After the snapshots are taken, you can continue to back up + new/changed files to "main". The snapshots will not contain the new + files. cfs21:~# cp /etc/termcap /mnt/main cfs21:~# ls /mnt/main -fstab passwd termcap +fstab passwd termcap +
- <indexterm><primary>backup</primary><secondary>using LVM</secondary><tertiary>restoring</tertiary></indexterm>Restoring the File System From a Snapshot - Use this procedure to restore the file system from an LVM snapshot. + + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + <tertiary>restoring</tertiary> + </indexterm>Restoring the File System From a Snapshot + Use this procedure to restore the file system from an LVM + snapshot. Rename the LVM snapshot. - Rename the file system snapshot from "main" to "back" so you can mount it without unmounting "main". This is recommended, but not required. Use the --reformat flag to tunefs.lustre to force the name change. For example: + Rename the file system snapshot from "main" to "back" so you + can mount it without unmounting "main". This is recommended, but not + required. Use the + --reformat flag to + tunefs.lustre to force the name change. For + example: cfs21:~# tunefs.lustre --reformat --fsname=back --writeconf /dev/vgmain/MDT0.b1 checking for existing Lustre data found Lustre data @@ -508,8 +1002,10 @@ Permanent disk data: (OST writeconf ) Persistent mount opts: errors=remount-ro,extents,mballoc Parameters: mgsnode=192.168.0.21@tcp -Writing CONFIGS/mountdata - When renaming an FS, we must also erase the last_rcvd file from the snapshots +Writing CONFIGS/mountdata + + When renaming a file system, we must also erase the last_rcvd + file from the snapshots cfs21:~# mount -t ldiskfs /dev/vgmain/MDT0.b1 /mnt/mdtback cfs21:~# rm /mnt/mdtback/last_rcvd cfs21:~# umount /mnt/mdtback @@ -518,30 +1014,91 @@ cfs21:~# rm /mnt/ostback/last_rcvd cfs21:~# umount /mnt/ostback - Mount the file system from the LVM snapshot. For example: + Mount the file system from the LVM snapshot. For + example: cfs21:~# mount -t lustre /dev/vgmain/MDT0.b1 /mnt/mdtback cfs21:~# mount -t lustre /dev/vgmain/OST0.b1 /mnt/ostback cfs21:~# mount -t lustre cfs21:/back /mnt/back - Note the old directory contents, as of the snapshot time. For example: + Note the old directory contents, as of the snapshot time. For + example: cfs21:~/cfs/b1_5/lustre/utils# ls /mnt/back -fstab passwds +fstab passwds +
- <indexterm><primary>backup</primary><secondary>using LVM</secondary><tertiary>deleting</tertiary></indexterm>Deleting Old Snapshots - To reclaim disk space, you can erase old snapshots as your backup policy dictates. Run: + + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + <tertiary>deleting</tertiary> + </indexterm>Deleting Old Snapshots + To reclaim disk space, you can erase old snapshots as your backup + policy dictates. Run: lvremove /dev/vgmain/MDT0.b1
- <indexterm><primary>backup</primary><secondary>using LVM</secondary><tertiary>resizing</tertiary></indexterm>Changing Snapshot Volume Size - You can also extend or shrink snapshot volumes if you find your daily deltas are smaller or larger than expected. Run: + + <indexterm> + <primary>backup</primary> + <secondary>using LVM</secondary> + <tertiary>resizing</tertiary> + </indexterm>Changing Snapshot Volume Size + You can also extend or shrink snapshot volumes if you find your + daily deltas are smaller or larger than expected. Run: lvextend -L10G /dev/vgmain/MDT0.b1 - Extending snapshots seems to be broken in older LVM. It is working in LVM v2.02.01. + Extending snapshots seems to be broken in older LVM. It is + working in LVM v2.02.01.
+
+ + <indexterm> + <primary>backup</primary> + <secondary>ZFS ZPL</secondary> + </indexterm>Migration Between ZFS and ldiskfs Target Filesystems + + Beginning with Lustre 2.11.0, it is possible to migrate between + ZFS and ldiskfs backends. For migrating OSTs, it is best to use + lfs find/lfs_migrate to empty out + an OST while the filesystem is in use and then reformat it with the new + fstype. For instructions on removing the OST, please see + . +
+ + <indexterm> + <primary>backup</primary> + <secondary>ZFS to ldiskfs</secondary> + </indexterm>Migrate from a ZFS to an ldiskfs based filesystem + The first step of the process is to make a ZFS backend backup + using tar as described in + . + Next, restore the backup to an ldiskfs-based system as described + in . +
+
+ + <indexterm> + <primary>backup</primary> + <secondary>ZFS to ldiskfs</secondary> + </indexterm>Migrate from an ldiskfs to a ZFS based filesystem + The first step of the process is to make an ldiskfs backend backup + using tar as described in + . + Caution:For a migration from + ldiskfs to zfs, it is required to enable index_backup before the + unmount of the target. This is an additional step for a regular + ldiskfs-based backup/restore and easy to be missed. + Next, restore the backup to an ldiskfs-based system as described + in . +
+
+