-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip useless xfs mount options when mounting during recovery #3058
Conversation
Copied from the btrfs code in usr/share/rear/layout/prepare/GNU/Linux/133_include_mount_filesystem_code.sh This approach has many shortcomings, document them in FIXME comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect!
In particular I appreciate the explanatory comments
that describe how it works and even more important
the FIXME parts that explain the current limitations
so others could easily enhance it later as needed.
@pcahyna |
It is an enhancement when ReaR even works in an I think in practice that situation is not as exotic as it seems By the way cf.
|
more descriptive name would be
Maybe it would be better to let the function let look for both options witjout values, and options with values, and remove them both? (And rename it.) My only worry is that there might be a case where an option without a value means something different than an option with a value. The oncly case I found where an option can be specified both with and without value is
|
@pcahyna |
Indeed. I described it as "exotic", because even in older RHEL versions that had more relaxed checks on XFS parameters I was not able to create the problematic combination of parameters. Probably there is some trick that I am missing, given that the bug report is real. |
The mount command displays all mount options for a filesystem, including those that are not explictitly set in fstab, and ReaR saves them to disk layout. In the case of XFS, some of them can be harmful for mounting the filesystem during layout restoration: The logbsize=... mount option is a purely performance/memory usage optimization option, which can lead to mount failures, because it must be an integer multiple of the log stripe unit and the log stripe unit can be different in the recreated filesystem from the original filesystem (for example when using MKFS_XFS_OPTIONS, or in some exotic situations involving an old filesystem, see GitHub issue rear#2777 ). If logbsize is not an integer multiple of the log stripe unit, mount fails with the warning "XFS (...): logbuf size must be greater than or equal to log stripe size" in the kernel log (and a confusing error message "mount: ...: wrong fs type, bad option, bad superblock on ..., missing codepage or helper program, or other error." from the mount command), causing the layout restoration in the recovery process to fail. Wrong sunit/swidth can cause mount to fail as well, with this in the kernel log: "kernel: XFS (...): alignment check failed: sunit/swidth vs. agsize". Therefore, remove the logbsize=... and sunit=.../swidth=... from XFS mount options before mounting the file system. (Another possibility would be to remove them already when saving the layout, in layout/save/GNU/Linux/230_filesystem_layout.sh, but I decided to follow the example of btrfs here.)
915f9ea
to
0cdcab0
Compare
@jsmeix thank you for having a look! |
Pull Request Details:
Type: Bug Fix
Impact: Normal
Reference to related issue (URL): closes XFS: diskrestore.sh failed at 'mount: /mnt/local: ...' because of wrong mount options #2777
How was this pull request tested?
Full backup and recovery with `MKFS_XFS_OPTIONS="-d sunit=128 -d swidth=128" and root on XFS. Before the change, recovery failed to mount the root filesystem during layout restoration.
Description of the changes in this pull request:
The mount command displays all mount options for a filesystem, including those that are not explictitly set in fstab, and ReaR saves them to disk layout. In the case of XFS, some of them can be harmful for mounting the filesystem during layout restoration:
The
logbsize=
... mount option is a purely performance/memory usage optimization option, which can lead to mount failures, because it must be an integer multiple of the log stripe unit and the log stripe unit can be different in the recreated filesystem from the original filesystem. It was reported for some some exotic situation apparently involving an old filesystem created with a version of xfsprogs that accepted values that it does not accept anymore, see GitHub issue #2777 . More importantly, it can occur when usingMKFS_XFS_OPTIONS
, because this will lead to a change of filesystem parameters and the mount options will no longer match. Iflogbsize
is not an integer multiple of the log stripe unit, mount fails with the warningXFS (...): logbuf size must be greater than or equal to log stripe size
in the kernel log (and a confusing error messagemount: ...: wrong fs type, bad option, bad superblock on ..., missing codepage or helper program, or other error.
from the mount command), causing the layout restoration in the recovery process to fail.Wrong sunit/swidth can cause mount to fail as well, with this in the kernel log:
kernel: XFS (...): alignment check failed: sunit/swidth vs. agsize
.Therefore, remove the
logbsize=
... andsunit=
.../swidth=
... from XFS mount options before mounting the file system.(Another option possibility be to remove them already when saving the layout, in layout/save/GNU/Linux/230_filesystem_layout.sh, but I decided to follow the example of btrfs here.)