BuyVM如何挂载存储盘

将存储盘分配到VPS

购买后,到https://manage.buyvm.net 登录面板Stallion找到Storage Volumes,查看你购买的存储盘,后面有个齿轮,点击进入设置,选择:“Attach to Virtual Server”,确认挂载到的你的某个VPS上

挂载硬盘

先通过ssh连接到linux服务器

然后用fdisk -l可以看前面后台分配存储盘到VPS下成功没。如果显示有二个盘就好。

查看硬盘列表:

ls /dev/disk/by-id/

然后会显示硬盘列表:ata-QEMU_DVD-ROM_QM00004 scsi-0BUYVM_SLAB_VOLUME-1111,其中后面的scsi-0BUYVM_SLAB_VOLUME-1111就是你的存储盘,结尾数字每个人不一样,注意后面要改你自己的。

格式化硬盘:

mkfs.ext4 -F /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-1111

创建挂载目录:(新建文件夹名storage,不要重复)

mkdir -p /storage

挂载硬盘到storage目录:

mount -o discard,defaults /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-1111 /storage

查看挂载结果:

df -ls

设置开机后自动挂载:

echo '/dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-1111 /storage ext4 defaults,nofail,discard 0 0' | tee -a /etc/fstab

重启VPS可以看看效果呢。

如果过程中出现错误:mkfs: failed to execute mkfs.ext4: No such file or directory

解决方法如下,需要安装e4fsprogs,Centos下安装命令如下:

yum install e4fsprogs -y
Last modification:June 25, 2023
If you think my article is useful to you, please feel free to appreciate