实验一:inode耗尽导致磁盘故障
实验步骤
- 新建一个约32MB大小的EXT4文件系统
- 分区
- 格式化
- 挂载
- 查看inode信息
- 编写一个测试程序,耗尽所有可用的inode
- 测试创建新文件
- 解决inode耗尽故障
实验过程
1.新建一个32M的EXT4的文件系统
分区
[root@Daring jason]# fdisk /dev/sde
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): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (787-2610, default 787):
Using default value 787
Last cylinder, +cylinders or +size{K,M,G} (787-2610, default 2610): +32M
Command (m for help): p
Disk /dev/sde: 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: 0xe4b1d138
Device Boot Start End Blocks Id System
/dev/sde1 1 262 2104483+ fd Linux raid autodetect
/dev/sde2 263 524 2104515 fd Linux raid autodetect
/dev/sde3 525 786 2104515 fd Linux raid autodetect
/dev/sde4 787 791 40162+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@Daring jason]# partprobe /dev/sde //探测新分的分区
sde sde1 sde2 sde3 sde4 //探测到新的分区
[root@Daring jason]# partprobe /dev/sde
格式化成ext4
[root@Daring jason]# mkfs.ext4 /dev/sde4
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
10040 inodes, 40160 blocks
2008 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=41156608
5 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or