Linux 阿里ECS磁盘容量扩展
问题描述:LAMP环境,阿里ECS的Mysql出错,链接数据库提示2002错误。
网上说明:
可能一、进程文件无写入权限。
可能二、数据盘容量空间已满。
原因分析:
原来的阿里云ECS数据盘是5G,用命令查看后其剩余容量为0,硬盘和文件占用情况如下:
数据库占用了3个G,网站文件占用了1.6G,空间告急,果断升级数据盘容量。
阿里云升级教程链接:https://help.aliyun.com/document_detail/ecs/operation-guide/disk-operation/resize.html
经本人操作,发现教程中的系统是 Ubuntu 14.04我的系统是CentOS,所以有点不同的操作,
具体详细操作步骤如下:
1、升级扩展盘容量,5G升级为10G,结果发现不用钱,哈哈。
2、重启服务器。
3、首先使用df -TH查看数据盘挂载点。
如图,结果发现其挂载点为 /mnt 和文档说明中的/mnt/dev1 不一样
所以删除硬盘挂载时 使用 umount /mnt
新的问题出现,Device is busy ! 很明显,是进程占用了,我MNT上的挂载点里的数据只和SVN和网站有关
由此判断,不是SVN的进程就是Httpd进程占用
结果我只运行了service httpd stop命令,umount就正常,说明是Httpd进程在读取WWW中的文件引起的,与SVN无关。
4、删除重新挂载分区和文档中的又不一样,如下图
不管它,照来,很顺利,最后成功了,具体操作如下所示
# df -TH
Filesystem Type Size UsedAvail Use% Mounted on
/dev/xvda1 ext4 22G 3.0G 18G15% /
tmpfs tmpfs 257M 0 257M 0% /dev/shm
/dev/xvdb1 ext3 5.3G 5.1G 0 100% /mnt
# umount /mnt
umount: /mnt: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
# service httpd stop
# umount /mnt
# fdisk -l
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x00073f45
Device Boot Start End Blocks IdSystem
/dev/xvda1 * 1 2611 20970496 83Linux
Disk /dev/xvdb: 10.7 GB, 10737418240 bytes
255 heads, 56 sectors/track, 1468 cylinders
Units = cylinders of 14280 * 512 = 7311360 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x176b652c
Device Boot Start End Blocks IdSystem
/dev/xvdb1 1 1468 10481492 83Linux
# fdisk /dev/xvdb
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): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1468, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1468, default 1468):
Using default value 1468
Command (m for help): wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# e2fsck -f /dev/xvdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/xvdb1: 67383/327680 files (0.6% non-contiguous), 1244783/1310183 blocks
# resize2fs /dev/xvdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/xvdb1 to 2620373 (4k) blocks.
The filesystem on /dev/xvdb1 is now 2620373 blocks long.
# mount /dev/xvdb1 /mnt
# df -TH
Filesystem Type Size UsedAvail Use% Mounted on
/dev/xvda1 ext4 22G 3.0G 18G15% /
tmpfs tmpfs 257M 0 257M 0% /dev/shm
/dev/xvdb1 ext3 11G 5.1G 5.1G51% /mnt
# service httpd start
# service mysqld start
Starting MySQL.. SUCCESS!
#
页:
[1]