请选择 进入手机版 | 继续访问电脑版

ylsunyuan技术论坛中心

 找回密码
 注册(请使用中文注册)
搜索
热搜: 活动 交友 discuz
查看: 762|回复: 0

Linux 阿里ECS磁盘容量扩展

[复制链接]

124

主题

127

帖子

619

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
619
发表于 2016-3-6 21:52:38 | 显示全部楼层 |阅读模式
问题描述:
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、删除重新挂载分区和文档中的又不一样,如下图


不管它,照来,很顺利,最后成功了,具体操作如下所示




  1. [root@iZ28na4xi3rZ ~]# df -TH
  2. Filesystem    Type     Size   Used  Avail Use% Mounted on
  3. /dev/xvda1    ext4      22G   3.0G    18G  15% /
  4. tmpfs        tmpfs     257M      0   257M   0% /dev/shm
  5. /dev/xvdb1    ext3     5.3G   5.1G      0 100% /mnt
  6. [root@iZ28na4xi3rZ ~]# umount /mnt
  7. umount: /mnt: device is busy.
  8.         (In some cases useful info about processes that use
  9.          the device is found by lsof(8) or fuser(1))
  10. [root@iZ28na4xi3rZ ~]# service httpd stop


  11. [root@iZ28na4xi3rZ ~]# umount /mnt


  12. [root@iZ28na4xi3rZ ~]# fdisk -l

  13. Disk /dev/xvda: 21.5 GB, 21474836480 bytes
  14. 255 heads, 63 sectors/track, 2610 cylinders
  15. Units = cylinders of 16065 * 512 = 8225280 bytes
  16. Sector size (logical/physical): 512 bytes / 512 bytes
  17. I/O size (minimum/optimal): 512 bytes / 512 bytes
  18. Disk identifier: 0x00073f45

  19.     Device Boot      Start         End      Blocks   Id  System
  20. /dev/xvda1   *           1        2611    20970496   83  Linux

  21. Disk /dev/xvdb: 10.7 GB, 10737418240 bytes
  22. 255 heads, 56 sectors/track, 1468 cylinders
  23. Units = cylinders of 14280 * 512 = 7311360 bytes
  24. Sector size (logical/physical): 512 bytes / 512 bytes
  25. I/O size (minimum/optimal): 512 bytes / 512 bytes
  26. Disk identifier: 0x176b652c

  27.     Device Boot      Start         End      Blocks   Id  System
  28. /dev/xvdb1               1        1468    10481492   83  Linux


  29. [root@iZ28na4xi3rZ ~]# fdisk /dev/xvdb

  30. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  31.          switch off the mode (command 'c') and change display units to
  32.          sectors (command 'u').

  33. Command (m for help): d
  34. Selected partition 1

  35. Command (m for help): n
  36. Command action
  37.    e   extended
  38.    p   primary partition (1-4)
  39. p
  40. Partition number (1-4): 1
  41. First cylinder (1-1468, default 1):
  42. Using default value 1
  43. Last cylinder, +cylinders or +size{K,M,G} (1-1468, default 1468):
  44. Using default value 1468

  45. Command (m for help): wq
  46. The partition table has been altered!

  47. Calling ioctl() to re-read partition table.
  48. Syncing disks.



  49. [root@iZ28na4xi3rZ ~]# e2fsck -f /dev/xvdb1
  50. e2fsck 1.41.12 (17-May-2010)
  51. Pass 1: Checking inodes, blocks, and sizes
  52. Pass 2: Checking directory structure
  53. Pass 3: Checking directory connectivity
  54. Pass 4: Checking reference counts
  55. Pass 5: Checking group summary information
  56. /dev/xvdb1: 67383/327680 files (0.6% non-contiguous), 1244783/1310183 blocks
  57. [root@iZ28na4xi3rZ ~]# resize2fs /dev/xvdb1
  58. resize2fs 1.41.12 (17-May-2010)
  59. Resizing the filesystem on /dev/xvdb1 to 2620373 (4k) blocks.
  60. The filesystem on /dev/xvdb1 is now 2620373 blocks long.


  61. [root@iZ28na4xi3rZ ~]# mount /dev/xvdb1 /mnt


  62. [root@iZ28na4xi3rZ ~]# df -TH
  63. Filesystem    Type     Size   Used  Avail Use% Mounted on
  64. /dev/xvda1    ext4      22G   3.0G    18G  15% /
  65. tmpfs        tmpfs     257M      0   257M   0% /dev/shm
  66. /dev/xvdb1    ext3      11G   5.1G   5.1G  51% /mnt


  67. [root@iZ28na4xi3rZ ~]# service httpd start
  68. [root@iZ28na4xi3rZ ~]# service mysqld start
  69. Starting MySQL.. SUCCESS!
  70. [root@iZ28na4xi3rZ ~]#
复制代码






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册(请使用中文注册)

x
回复

使用道具 举报

本版积分规则

QQ|Archiver|手机版|小黑屋|ylsunyuan技术论坛 ( 桂ICP备14005218号-1

GMT+8, 2024-3-29 07:14 , Processed in 0.059384 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表