There are two methods to configure the storage backend for use by Swift.

We now create an xfs filesystem out of the partition or the loopback device we just created. For the loopback file, doing "file swift-disk" will give the details of the device. For the partition details, tune2fs utility can be used with "l" parameter.

For the physical partition:

sudo mkfs.xfs -i size=1024 /dev/sdb1
sudo tune2fs -l /dev/sdb1 |grep -i inode

For the loopback file:

sudo mkfs.xfs -i size=1024 /srv/swift-disk
file /srv/swift-disk
swift-disk1: SGI XFS filesystem data (blksz 4096, inosz 1024, v2 dirs)

The storage device we created has to be mounted automatically everytime the system starts. Lets create an arbitrary mountpoint /mnt/sdb1.

sudo mkdir /mnt/sdb1

Edit /etc/fstab and append the following line:

For the physical partiton

/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0

If you have a loopback file

/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0

Let's now mount the storage device and create directories (which would act as storage nodes) and provide appropriate permissions and ownerships (user:group format) for them. I have set the ownership to swift:swift for all relevant files.

sudo mount /mnt/sdb1
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
sudo chown swift:swift /mnt/sdb1/*
sudo ln -s /mnt/sdb1/1 /srv/1
sudo ln -s /mnt/sdb1/2 /srv/2
sudo ln -s /mnt/sdb1/3 /srv/3
sudo ln -s /mnt/sdb1/4 /srv/4
sudo mkdir -p /etc/swift/object-server /etc/swift/container-server /etc/swift/account-server /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift
sudo chown -R swift:swift /etc/swift /srv/[1-4]/

Append the following lines to /etc/rc.local just before the "exit 0":

mkdir /var/run/swift
chown swift:swift /var/run/swift

loading table of contents...