github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/sait/home/swift/bin/resetswift (about)

     1  #!/bin/bash
     2  
     3  if [ "$1" != "1" ] && [ "$1" != "2" ] && [ "$1" != "3" ]
     4  then
     5      echo Arg1 is unexpected: $1
     6      exit 1
     7  fi
     8  
     9  set -e
    10  
    11  SAIT_INSTANCE=$1
    12  
    13  sudo swift-init all kill
    14  
    15  if cut -d' ' -f2 /proc/mounts | grep -q /srv/$SAIT_INSTANCE/node/sdb$SAIT_INSTANCE
    16  then
    17      sudo umount /srv/$SAIT_INSTANCE/node/sdb$SAIT_INSTANCE
    18  fi
    19  sudo truncate -s 0 /srv/swift-disk
    20  sudo truncate -s 1GB /srv/swift-disk
    21  sudo mkfs.xfs -f /srv/swift-disk
    22  sudo mount /srv/$SAIT_INSTANCE/node/sdb$SAIT_INSTANCE
    23  sudo chown swift:swift /srv/$SAIT_INSTANCE/node/sdb$SAIT_INSTANCE
    24  
    25  sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
    26  find /var/cache/swift* -type f -name *.recon -exec rm -f {} \;
    27  sudo systemctl restart memcached