网站中上传文件的文件夹 /var/www/mysite/wwwroot/Upload 会有许多大文件,如果使用ecs的存储空间,很快会占满。需要使用NAS文件存储服务
1.阿里云购买NAS文件存储系统
购买后挂载地址为 1301dxxxx-crk30.cn-beijing.nas.aliyuncs.com
2.centos 安装NFS客户端
yum install nfs-utils
3. 挂载
mount -t nfs -o vers=4.0 1301dxxxx-crk30.cn-beijing.nas.aliyuncs.com:/ /var/www/mysite/wwwroot/Upload
取消挂载: umount /var/www/mysite/wwwroot/Upload
查看 centos 磁盘空间占用情况 : df -k
查看挂载的文件夹使用了多少空间 du -sh /var/www/mysite/wwwroot/Upload 管理控制台也可以看到显示,不过这个显示有一些延迟
4.centos开机自动挂载
修改 /etc/rc.local
vi /etc/rc.local
[root@localhost etc]# vi rc.local
#!/bin/sh
#
# This script will be executed after all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount -t nfs -o vers=4.0 1301dxxxx-crk30.cn-beijing.nas.aliyuncs.com:/ /var/www/mysite/wwwroot/Upload