Liunx 磁盘扩容踩坑总结

Liunx 磁盘扩容踩坑总结

查看当前磁盘使用
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             40G   36G  2.8G  93% /
tmpfs                1003M     0 1003M   0% /dev/shm
/dev/xvdb1             20G   16G  2.8G  86% /home/www
/dev/xvdc              15G   15G     0 100% /home/svn
我们在阿里云扩容/dev/xvdc 这个盘之后查看磁盘详解
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# fdisk -l

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0x00071419

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1        5222    41940992   83  Linux

Disk /dev/xvdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x453417b4

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1        2610    20964793+  83  Linux

Disk /dev/xvdc: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x00000000

Disk /dev/xvdc doesn't contain a valid partition table
强制检查磁盘使用情况
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# e2fsck -f /dev/xvdc
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found.  Create<y>? yes

Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/xvdc: ***** FILE SYSTEM WAS MODIFIED *****
/dev/xvdc: 343096/983040 files (3.1% non-contiguous), 3788579/3932160 blocks
重定义磁盘大小
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# resize2fs  /dev/xvdc
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/xvdc to 7864320 (4k) blocks.
The filesystem on /dev/xvdc is now 7864320 blocks long.

重新挂载光驱
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# mount   /dev/xvdc /home/svn
查询磁盘使用情况
[root@iZ2zebzrd1fwcb8kj2g8xiZ ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             40G   36G  2.8G  93% /
tmpfs                1003M     0 1003M   0% /dev/shm
/dev/xvdb1             20G   16G  2.8G  86% /home/www
/dev/xvdc              30G   15G   14G  51% /home/svn
  • 注:磁盘格式一定要用ext4

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

Last modification:June 7th, 2019 at 12:38 am
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment