格式化硬盘出现/dev/sdb5 is apparently in use by the system错误

错误以下:node

[root@hpf-linux~]# mke2fs -t ext3 -b 2048 -m 3 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
/dev/sdb5 is apparently in use by the system; will not make a 文件系统 here!


提示/dev/sdb5  正在被使用。 /dev/sdb5 正在被DM管理,因此咱们建立文件系统时提示报错,咱们手工的移除,就能够正常的建立文件系统,操做以下:
linux

[root@hpf-linux~]# cat /proc/partitions 
major minor  #blocks  name
   8        0   20971520 sda
   8        1     204800 sda1
   8        2    5120000 sda2
   8        3    2048000 sda3
   8        4          1 sda4
   8        5   13596672 sda5
   8       16   20971520 sdb
   8       17    5253223 sdb1
   8       18    2104515 sdb2
   8       19    3156772 sdb3
   8       20          1 sdb4
   8       21    2104483 sdb5
   8       32   18874368 sdc
 253        0    5253223 dm-0
 253        1    2104515 dm-1
 253        2    3156772 dm-2
 253        3          1 dm-3
 253        4    2104483 dm-4

从上面能够看到dm工具确实在用。
bash

[root@hpf-linux~]# dmsetup status
sdb3: 0 6313545 linear 
sdb2: 0 4209030 linear 
sdb1: 0 10506447 linear 
sdb5: 0 4208967 linear 
sdb4: 0 2 linear 
[root@hpf-linux~]# dmsetup remove_all
[root@hpf-linux~]# dmsetup status
No devices found
[root@hpf-linux~]# mke2fs -t ext3 -b 2048 -m 3 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操做系统:Linux
块大小=2048 (log=1)
分块大小=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131560 inodes, 1052240 blocks
31567 blocks (3.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=538968064
65 block groups
16384 blocks per group, 16384 fragments per group
2024 inodes per group
Superblock backups stored on blocks: 
16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816
正在写入inode表: 完成                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.