From 00edc95c6bd80927c727742ac044082f64b26bec Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Thu, 17 May 2012 11:10:36 -0500 Subject: [PATCH] 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 --- stack.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stack.sh b/stack.sh index 0ee2ab87b6..13cf62a8fa 100755 --- a/stack.sh +++ b/stack.sh @@ -1347,16 +1347,20 @@ if is_service_enabled swift; then 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.