1.先明确nas存储盘已经挂到了本机器上
2.利用dd模拟出一个新的空白占位文件。(of写到你挂载的那个目录:这个应该是上面的/srv/node/vdd)
dd if=/dev/zero of=/yfyshare/5T_151.img bs=1G seek=5115 count=0
3.格式化/赋权限/挂载空文件
mkfs.xfs 5T_152.img
mkdir -p /srv/node/sda
chmod 777 /srv/node/sda
vim /etc/fstab
/yfyshare/5T_151.img /srv/node/sda xfs defaults.loop
mount -a
4.之后同理重新构建ring 分发即可。
5.总结nas挂载过来并非完整的裸磁盘,会导致swift无法真正挂载成功,必须dd成占位文件格式化后重新挂载才行。
附上裸磁盘挂载的方式
---shell
#!/bin/sh
ECHO_GREEN() {
stty erase '^H'
echo -n -e "\033[32m$1\033[0m"
}
ECHO_GREEN "Please Input DEVICE (example: sdx): "; read DEVICE
DEVICE_PATH=/dev/${DEVICE}
DEFAULT_NODE_PATH=/srv/node/${DEVICE}
ECHO_GREEN "Please Input NODE (default: ${DEFAULT_NODE_PATH}): "; read NODE_PATH
NODE_PATH=${NODE_PATH:-${DEFAULT_NODE_PATH}}
echo -e "\n"
echo " # DEVICE: ${DEVICE}"
echo " # NODE_PATH: ${NODE_PATH}"
echo " # fstab: ${DEVICE_PATH} ${NODE_PATH} xfs noatime,nodiratime,nobarrier,logbufs=8 0 2"
echo -e "\n"
ECHO_GREEN ' # VERIFY ? (YES/NO): '; read VERIFY
[[ ${VERIFY} == 'YES' ]] || [[ ${VERIFY} == 'yes' ]] && \
if [ -b ${DEVICE_PATH} ]; then
mkfs.xfs ${DEVICE_PATH}
mkdir -p ${NODE_PATH}
echo "${DEVICE_PATH} ${NODE_PATH} xfs noatime,nodiratime,nobarrier,logbufs=8 0 2" >> /etc/fstab
mount -a
chown -R swift:swift ${NODE_PATH}
else
echo -e "\n Error Device does not exist"
fi
网友评论