前言
之前购买的buyvm服务器最低配,有时候启动一些服务,数据库会莫名其妙的关闭,查询之下有可能是内存不够的问题,也是,0.5G内存却跑着几个站点,再升级一下配置也就1刀,升级之后,宝塔的数据没更新???
问题
- 宝塔的内存不变?
- 硬盘大小不变?(大坑)
解决办法
- 重启服务器,注意不是reset service,而是先
power off
然后setup
,reset
是没有用的 - 硬盘问题比较硬核啊
服务器硬盘不是重启就能更新的,在升级服务器之后,供应商会分配额外的硬盘给我,但是不会之间加上去,而是创建一个分区的方式给我们,所以我们解决的思路是 将两个分区的硬盘合并!
之前试过用工具 growpart
但是会报错,什么xxx is blocked. nothing to do!网上说什么改utf-8,我是没用,换了一种方案,我觉的这方案无敌
- 利用
fdisk
工具,好像linux自带把我是之间可以打开的,disk管理命令 fdisk -l
查看当前的磁盘情况
[root@localhost ~]# fdisk -l
Disk /dev/vda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00095367
Device Boot Start End Blocks Id System
/dev/vda1 2048 41943039 20970496 83 Linux
- 进入到
/dev/vda
分区
[root@localhost ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
- 进行如下操作
p
查看当前分区情况
d
删除分区,我们先全部删掉,有几个删几个,数据不会删除n
创建分区,选择默认就行p
选择创建的为主分区
有数字选择就默认为空,直接回车Partition 1 of type Linux and of size 20 GiB is set
wq
保存退出
reboot
重启服务器resize2fs /dev/vda
刷新硬盘df -h
检查是否成功
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 486M 0 486M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 6.7M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/vda1 20G 6.4G 13G 35% /
tmpfs 100M 0 100M 0% /run/user/0
总结
查询了半天资料才找到的最佳方案,其实就是将分区重置一下就可以了
参考资料
https://stackoverflow.com/questions/11014584/ec2-cant-resize-volume-after-increasing-size
评论 (0)