Skip to contentSkip to conversation

Any guide to replace a xfs logdev?

DISCUSSION Wang Yugui 2 participants 3 messages Feb 8, 2022 – Feb 9, 2022

lore
Share & tools
lore

Wang Yugui

author
#0 lore raw

Hi,

Any guide to replace a xfs logdev?

case 1: logdev device failed.
case 2: replace the logdev with a new NVDIMM-N device.

but I failed to find out some guide to replace a xfs logdev.

Best Regards
Wang Yugui ([email protected])
2022/02/08

#1 lore raw
Quoted 8 lines · Wang Yugui

Hi,

Any guide to replace a xfs logdev?

case 1: logdev device failed.
case 2: replace the logdev with a new NVDIMM-N device.

but I failed to find out some guide to replace a xfs logdev.

The external log is specified at mount time on the mount command line, so all you should need to do is use the "-o logdev=/dev/XXX" option to point at the new device, which must be at least as large as the old device, and should be completely zeroed.

If the filesystem was cleanly unmounted, this should be all that is required.

If the log device failed during operation, the filesystem is probably not consistent, and you will most likely need to run an xfs_repair, zeroing out the log and repairing any inconsistencies, since your log device has failed and no longer replayable. So, something like:

# xfs_repair -L -l /dev/newlogdevice /dev/xfsdevice

where /dev/xfsdevice is your data device holding the filesystem, and /dev/newlogdevice is your new/replaced log device.

Before you actually do this, you might want to see if anyone corrects my statements or notices anything I missed. ;)

-Eric

Quoted 6 lines

Best Regards
Wang Yugui ([email protected])
2022/02/08

author
#2 lore raw

Hi,

Thanks a lot.

'xfs_repair -L' works well to replace a xfs logdev. # kernel: 4.18.0-348 / 5.15.21

but a qestion 'cleanly unmounted' below.

Quoted 8 lines · Wang Yugui
Quoted 7 lines

Hi,

Any guide to replace a xfs logdev?

case 1: logdev device failed.
case 2: replace the logdev with a new NVDIMM-N device.

Quoted 8 lines
Quoted 1 line

but I failed to find out some guide to replace a xfs logdev.

The external log is specified at mount time on the mount command line, so all you should need to do is use the "-o logdev=/dev/XXX" option to point at the new device, which must be at least as large as the old device, and should be completely zeroed.

If the filesystem was cleanly unmounted, this should be all that is required.

'mount -o logdev=/dev/newlogdevice' failed,
# kernel: 4.18.0-348(centos 8.5) / 5.15.21

the message in dmesg:
Corruption warning: Metadata has LSN (1:6) ahead of current LSN (1:0). Please unmount and run xfs_repair (>= v4.3) to resolve.

/dev/newlogdevice is with a same size, and zeroed by blkdiscard(SSD)

'umount' is not enough to get a ' cleanly unmounted'?

Quoted 5 lines

If the log device failed during operation, the filesystem is probably not consistent, and you will most likely need to run an xfs_repair, zeroing out the log and repairing any inconsistencies, since your log device has failed and no longer replayable. So, something like:

Quoted 7 lines
# xfs_repair -L -l /dev/newlogdevice /dev/xfsdevice

where /dev/xfsdevice is your data device holding the filesystem, and /dev/newlogdevice is your new/replaced log device.

Before you actually do this, you might want to see if anyone corrects my statements or notices anything I missed. ;)

Best Regards
Wang Yugui ([email protected])
2022/02/09