From a58323766bd79eaccbb545d2b77f5f1c17aa8190 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Sun, 30 Apr 2023 11:10:07 +0900 Subject: [PATCH] scylla_raid_setup: wipe filesystem signatures from specified disks The discussion on the thread says, when we reformat a volume with another filesystem, kernel and libblkid may skip to populate /dev/disk/by-* since it detected two filesystem signatures, because mkfs.xxx did not cleared previous filesystem signature. To avoid this, we need to run wipefs before running mkfs. Note that this runs wipefs twice, for target disks and also for RAID device. wipefs for RAID device is needed since wipefs on disks doesn't clear filesystem signatures on /dev/mdX (we may see previous filesystem signature on /dev/mdX when we construct RAID volume multiple time on same disks). Also dropped -f option from mkfs.xfs, it will check wipefs is working as we expected. Fixes #13737 Signed-off-by: Takuya ASADA Closes #13738 (cherry picked from commit fdceda20ccb3d15456d5b2af8582a01bd89e3aad) --- dist/common/scripts/scylla_raid_setup | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/common/scripts/scylla_raid_setup b/dist/common/scripts/scylla_raid_setup index 8454058293..9dfbcb59b8 100755 --- a/dist/common/scripts/scylla_raid_setup +++ b/dist/common/scripts/scylla_raid_setup @@ -125,9 +125,12 @@ if __name__ == '__main__': procs.append(proc) for proc in procs: proc.wait() + for disk in disks: + run(f'wipefs -a {disk}', shell=True, check=True) if raid: run('udevadm settle', shell=True, check=True) run('mdadm --create --verbose --force --run {raid} --level={level} -c1024 --raid-devices={nr_disk} {disks}'.format(raid=fsdev, level=args.raid_level, nr_disk=len(disks), disks=args.disks.replace(',', ' ')), shell=True, check=True) + run(f'wipefs -a {fsdev}', shell=True, check=True) run('udevadm settle', shell=True, check=True) major_minor = os.stat(fsdev).st_rdev @@ -138,7 +141,7 @@ if __name__ == '__main__': # and it also cannot be smaller than the sector size. block_size = max(1024, sector_size) run('udevadm settle', shell=True, check=True) - run(f'mkfs.xfs -b size={block_size} {fsdev} -f -K', shell=True, check=True) + run(f'mkfs.xfs -b size={block_size} {fsdev} -K', shell=True, check=True) run('udevadm settle', shell=True, check=True) if is_debian_variant():