您现在的位置是:首页 > 个人博客日记 个人博客日记

Liunx 磁盘扩容踩坑总结

2018-09-21 10:23:00

Liunx 磁盘扩容踩坑总结

查看当前磁盘使用
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/xvda1 40G 36G 2.8G 93% /
  4. tmpfs 1003M 0 1003M 0% /dev/shm
  5. /dev/xvdb1 20G 16G 2.8G 86% /home/www
  6. /dev/xvdc 15G 15G 0 100% /home/svn
我们在阿里云扩容/dev/xvdc 这个盘之后查看磁盘详解
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# fdisk -l
  2. Disk /dev/xvda: 42.9 GB, 42949672960 bytes
  3. 255 heads, 63 sectors/track, 5221 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5. Sector size (logical/physical): 512 bytes / 512 bytes
  6. I/O size (minimum/optimal): 512 bytes / 512 bytes
  7. Disk identifier: 0x00071419
  8. Device Boot Start End Blocks Id System
  9. /dev/xvda1 * 1 5222 41940992 83 Linux
  10. Disk /dev/xvdb: 64.4 GB, 64424509440 bytes
  11. 255 heads, 63 sectors/track, 7832 cylinders
  12. Units = cylinders of 16065 * 512 = 8225280 bytes
  13. Sector size (logical/physical): 512 bytes / 512 bytes
  14. I/O size (minimum/optimal): 512 bytes / 512 bytes
  15. Disk identifier: 0x453417b4
  16. Device Boot Start End Blocks Id System
  17. /dev/xvdb1 1 2610 20964793+ 83 Linux
  18. Disk /dev/xvdc: 32.2 GB, 32212254720 bytes
  19. 255 heads, 63 sectors/track, 3916 cylinders
  20. Units = cylinders of 16065 * 512 = 8225280 bytes
  21. Sector size (logical/physical): 512 bytes / 512 bytes
  22. I/O size (minimum/optimal): 512 bytes / 512 bytes
  23. Disk identifier: 0x00000000
  24. Disk /dev/xvdc doesn't contain a valid partition table
强制检查磁盘使用情况
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# e2fsck -f /dev/xvdc
  2. e2fsck 1.41.12 (17-May-2010)
  3. Pass 1: Checking inodes, blocks, and sizes
  4. Pass 2: Checking directory structure
  5. Pass 3: Checking directory connectivity
  6. /lost+found not found. Create<y>? yes
  7. Pass 4: Checking reference counts
  8. Pass 5: Checking group summary information
  9. /dev/xvdc: ***** FILE SYSTEM WAS MODIFIED *****
  10. /dev/xvdc: 343096/983040 files (3.1% non-contiguous), 3788579/3932160 blocks
重定义磁盘大小
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# resize2fs /dev/xvdc
  2. resize2fs 1.41.12 (17-May-2010)
  3. Resizing the filesystem on /dev/xvdc to 7864320 (4k) blocks.
  4. The filesystem on /dev/xvdc is now 7864320 blocks long.
重新挂载光驱
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# mount /dev/xvdc /home/svn
查询磁盘使用情况
  1. [root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/xvda1 40G 36G 2.8G 93% /
  4. tmpfs 1003M 0 1003M 0% /dev/shm
  5. /dev/xvdb1 20G 16G 2.8G 86% /home/www
  6. /dev/xvdc 30G 15G 14G 51% /home/svn
  • 注:磁盘格式一定要用ext4

ext3文件系统一级子目录的个数默认为32000个,去掉.目录(代表当前目录)和..目录(代表上级目录),实际只能建31998个,ext3文件系统下单个目录里的最大文件数无特别的限制,是受限于所在文件系统的inode数



关注TinyMeng博客,更多精彩分享,敬请期待!
 

站点信息