Merge branch 'master' of github.com:ungleich/ungleich-tools
This commit is contained in:
commit
3292fc932d
7 changed files with 51 additions and 12 deletions
|
@ -15,4 +15,4 @@ ceph-authtool "$fname" --gen-key -n client.admin \
|
|||
--cap mon 'allow *' \
|
||||
--cap osd 'allow *' \
|
||||
--cap mgr 'allow *' \
|
||||
--cap mds 'allow'
|
||||
--cap mds 'allow *'
|
||||
|
|
9
ceph-osd-create-on-all-disks
Executable file
9
ceph-osd-create-on-all-disks
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
lsblk -b | awk '/^sd/ { print $1 " " $4/(1024^4) }' |
|
||||
(
|
||||
while read disk size; do
|
||||
/opt/ungleich-tools/ceph-osd-create-start /dev/$disk hdd $size
|
||||
|
||||
done
|
||||
)
|
|
@ -20,15 +20,15 @@ magic="ceph osd volume v026"
|
|||
set -x
|
||||
set -e
|
||||
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "$0 disk class osdweight"
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "$0 disk class [osdweight]"
|
||||
echo "class = hdd or ssd"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export DEV=$1;shift
|
||||
export CLASS=$1; shift
|
||||
export WEIGHT=$1; shift
|
||||
|
||||
|
||||
uuid_metadata=$(uuidgen)
|
||||
uuid_block=$(uuidgen)
|
||||
|
@ -42,15 +42,14 @@ dev_block="/dev/disk/by-partuuid/$uuid_block"
|
|||
--partition-guid="0:$uuid_metadata" \
|
||||
--typecode=0:4fbd7e29-9d25-41b8-afd0-062c0ceff05d \
|
||||
--mbrtogpt -- $DEV
|
||||
|
||||
/sbin/udevadm settle --timeout=600
|
||||
|
||||
|
||||
# Using gdisk --largest-new does not change the name or set guid;
|
||||
# So use 2 steps instead
|
||||
/sbin/sgdisk --largest-new=0 --mbrtogpt -- $DEV
|
||||
/sbin/udevadm settle --timeout=600
|
||||
|
||||
|
||||
lastpart=$(gdisk -l $DEV | tail -n1 | awk '{ print $1 }')
|
||||
/sbin/sgdisk --change-name="${lastpart}:ceph block" \
|
||||
--partition-guid="${lastpart}:$uuid_block" \
|
||||
|
@ -58,7 +57,6 @@ lastpart=$(gdisk -l $DEV | tail -n1 | awk '{ print $1 }')
|
|||
--mbrtogpt -- $DEV
|
||||
/sbin/udevadm settle --timeout=600
|
||||
|
||||
|
||||
/sbin/mkfs -t xfs -f -i size=2048 -- "$dev_metadata"
|
||||
|
||||
mountpath=/var/lib/ceph/osd/ceph-${osd_id}
|
||||
|
@ -85,6 +83,14 @@ touch "$mountpath/sysvinit"
|
|||
ceph-osd --cluster ceph -i "${osd_id}" --mkfs
|
||||
chown -R ceph:ceph "$mountpath"
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
WEIGHT=$1; shift
|
||||
else
|
||||
devname=$(readlink -f $dev_block)
|
||||
nodev=$(echo $devname | sed 's,/dev/,,')
|
||||
WEIGHT=$(lsblk -l -b | awk "/^$nodev/ { print \$4/(1024^4) }")
|
||||
fi
|
||||
|
||||
ceph osd crush add osd.${osd_id} ${WEIGHT} host=$(hostname)
|
||||
|
||||
echo "$metadata_dev /var/lib/ceph/osd/ceph-${osd_id} xfs noatime 0 0" >> /etc/fstab
|
||||
|
|
13
ceph-pool-create
Normal file → Executable file
13
ceph-pool-create
Normal file → Executable file
|
@ -1,9 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
pool=$1; shift
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "$0 name pgs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "This script is not finished to create pool $pool"
|
||||
name=$1; shift
|
||||
pg=$1;shift
|
||||
|
||||
exit 1
|
||||
|
||||
ceph osd pool application enable
|
||||
ceph osd pool create "$name" "$pg"
|
||||
ceph osd pool application enable "$name" rbd
|
||||
|
|
5
disk-create-fresh-gpt
Executable file
5
disk-create-fresh-gpt
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
disk=$1
|
||||
|
||||
printf 'g\nw' | fdisk $disk
|
11
remove-all-partitions
Executable file
11
remove-all-partitions
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo $0 disk-to-be-deleted
|
||||
exit 1
|
||||
fi
|
||||
|
||||
disk=$1
|
||||
|
||||
sgdisk -Z "$disk"
|
||||
dd if=/dev/zero of=$disk bs=1M count=10
|
5
remove-all-partitions-from-all-disks
Executable file
5
remove-all-partitions-from-all-disks
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
for disk in $(fdisk -l | grep "^Disk /dev" | sed -e 's/Disk //' -e 's/:.*//'); do
|
||||
sgdisk -Z "$disk"
|
||||
done
|
Loading…
Reference in a new issue