From 32636437b71ac8ad0e6f258379027eeb87a3f662 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Feb 2018 20:51:02 +0100 Subject: [PATCH] hdparm fails if called to often to fast: The operation has completed successfully. + hdparm -z /dev/sdb /dev/sdb: re-reading partition table + /sbin/sgdisk --largest-new=0 --mbrtogpt -- /dev/sdb Warning: The kernel is still using the old partition table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) The operation has completed successfully. + hdparm -z /dev/sdb /dev/sdb: re-reading partition table BLKRRPART failed: Device or resource busy --- ceph-osd-create-start | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ceph-osd-create-start b/ceph-osd-create-start index 01714f1..0d06a3d 100755 --- a/ceph-osd-create-start +++ b/ceph-osd-create-start @@ -43,19 +43,21 @@ dev_block="/dev/disk/by-partuuid/$uuid_block" --typecode=0:4fbd7e29-9d25-41b8-afd0-062c0ceff05d \ --mbrtogpt -- $DEV -hdparm -z "$DEV" +sleep 2 ; hdparm -z "$DEV" # Using gdisk --largest-new does not change the name or set guid; # So use 2 steps instead /sbin/sgdisk --largest-new=0 --mbrtogpt -- $DEV -hdparm -z "$DEV" + +sleep 2 ; hdparm -z "$DEV" lastpart=$(gdisk -l $DEV | tail -n1 | awk '{ print $1 }') /sbin/sgdisk --change-name="${lastpart}:ceph block" \ --partition-guid="${lastpart}:$uuid_block" \ --typecode="${lastpart}:cafecafe-9b03-4f30-b4c6-b4b80ceff106" \ --mbrtogpt -- $DEV -hdparm -z "$DEV" +sleep 2 ; hdparm -z "$DEV" + /sbin/mkfs -t xfs -f -i size=2048 -- "$dev_metadata"