Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F107106
staging-ms-be-01.sh
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
thcipriani
Mar 30 2015, 6:07 PM
2015-03-30 18:07:14 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
staging-ms-be-01.sh
View Options
#!/usr/bin/env bash
# Creates, formats and mounts swift storage loop drives
# should be idempotent, probably isn't -- caveat emptor
printf
'This script creates and mounts some loop back devices for swift, you good? [y/N] '
read
ans
if
[
!
"
$ans
"
=
'y'
]
&&
[
!
"
$ans
"
=
'Y'
]
;
then
printf
"Answer: '
${
ans
}
' was not 'Y' or 'y', exiting...\n"
exit
fi
config
=
'/etc/swift'
storage
=
'/srv/swift-storage'
images
=
"
${
storage
}
/images"
mkdir -p
"
${
images
}
"
# https://wikitech.wikimedia.org/wiki/Swift/Setup_New_Swift_Cluster#Setup_file_systems
image
=
"
${
images
}
/swift-sdb.img"
mount_point
=
"
${
storage
}
/sdb1"
label
=
"swift-sdb1"
mkdir -p
"
${
mount_point
}
"
if
[
! -f
"
${
image
}
"
]
;
then
touch
"
${
image
}
"
# resize img file to 5G
truncate -s 10G
"
${
image
}
"
# format
/sbin/mkfs.xfs -f -i
size
=
512
-L
"
${
label
}
"
"
${
image
}
"
if
! egrep -q
"
${
mount_point
}
"
/proc/mounts
;
then
mount -t xfs -o loop,rw,noatime,nodiratime,nobarrier,logbufs
=
8
"
${
image
}
"
"
${
mount_point
}
"
chown -R swift:swift
"
${
mount_point
}
"
else
printf
'[$(tput red)ERROR$(tput sgr0)] Mount point %s already exists'
"
${
mount_point
}
"
exit
1
fi
else
printf
'[$(tput red)ERROR$(tput sgr0)] File %s already exists'
"
${
image
}
"
exit
1
fi
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
103938
Default Alt Text
staging-ms-be-01.sh (1 KB)
Attached To
Mode
P453 staging-ms-be-01.sh
Attached
Detach File
Event Timeline
Log In to Comment