Create new swift data store filesystem every time
The Swift data store was not cleaned out between stack.sh runs; although
the contents were not visible they were still taking up space. Create a
new XFS filesystem on every stack.sh run.
Fixes bug 1000827
Change-Id: Ieab6b5f65b7964906f244975cbcdf2cf50344ca5
diff --git a/stack.sh b/stack.sh
index 0ee2ab8..13cf62a 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1347,16 +1347,20 @@
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
# We then create a loopback disk and format it to XFS.
- # TODO: Reset disks on new pass.
- if [[ ! -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
+ if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
+ if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
+ sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
+ fi
+ else
mkdir -p ${SWIFT_DATA_DIR}/drives/images
sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img
sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
- mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
fi
+ # Make a fresh XFS filesystem
+ mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
# After the drive being created we mount the disk with a few mount
# options to make it most efficient as possible for swift.