- A+
一、解决的问题
1、数据盘未挂载
2、网站建设到系统盘,移动至数据盘
二、问题说明
在昨天的内容当中(linux服务器数据库启动失败),一直在想为什么只有20G,然后查看了自己的订单,发现自己购买的40G的数据盘,然后通过命令“fdisk -l”查看如下图
居然40G被闲置着未被挂载
三、挂载数据盘
1、为了安全,全站进行打包处理(由于我使用的是阿里云的空间,可以直接使用阿里云的快照管理,如网站出现问题,可使用回滚业务,直接返回到最好的状态)
2、命令“fdisk -l”
3、对数据盘分区“fdisk -S 56 /dev/xvdb”
4、执行“n” “p” “1” 回车两次 “wq” ,用不了多久的时间(中间插曲手贱按多了,然后一脸茫然的到处乱按)
补充错误部分
(现在我们在 sdb 这个设备上创建一个新的分区:
[root@FCoE ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xcdd48395.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). 错误提示,下方红色为按键,回车,其他部分直接回车键
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): 回车
Using default value 261
Command (m for help): p
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcdd48395
Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks. )
5、格式化数据盘“mkfs.ext3 /dev/xvdb”
6、使用“echo '/dev/xvdb1 /mnt ext3 defaults 0 0' >> /etc/fstab”(不含引号)命令写入新分区信息。
然后使用“cat /etc/fstab”命令查看,出现以下信息就表示写入成功。 (其中mnt,可以变化为其他,创建新的文件夹“mkdir test”)
7、使用“mount -a”命令挂载新分区,然后用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了。
四、数据盘使用
1、复制文件夹至数据盘命令“cp -R file1 file2 ” (解释“-R 为递归处理,一个目录下有多个文件夹时候使用),在不熟悉的情况下,切记不要使用MV 命令,等待复制结束
耐心等待移动完成,不要终端,我这边数据大概在10G左右,复制时间在2-4分钟左右
2、修改wdcp后台-系统设置-web根目录(修改成新的),后重启服务器(可能重启时间有点长,不用担心)
3、至此整体工作完成了,至于数据库觉得不用搬,人懒。