Centos下无法格式化硬盘/dev/sd* is apparently in use by the system; will not make a filesystem here!

前端之家收集整理的这篇文章主要介绍了Centos下无法格式化硬盘/dev/sd* is apparently in use by the system; will not make a filesystem here!前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

环境说明

Centos 6.8

问题说明

新装的Linux系统,两块硬盘,一块作为系统磁盘,另一块作为数据磁盘,安装完系统后,由于该数据磁盘中包含之前残余的LVM信息,无法对数据磁盘无法进行操作。

新系统启动后,通过fdisk -l查看磁盘信息如下

[root@ovirt-host ~]# fdisk -l


Disk /dev/sda: 999.7 GB,999653638144 bytes
255 heads,63 sectors/track,121534 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: 0x000d16e8


 Device Boot   Start     End   Blocks  Id System
/dev/sda1  *      1     131   1048576  83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2       131    4211  32768000  82 Linux swap / Solaris
/dev/sda3      4211   121535  942406656  83 Linux


Disk /dev/sdb: 999.7 GB,121534 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: 0x000a65a6


 Device Boot   Start     End   Blocks  Id System
/dev/sdb1        1   121534  976221823+ 83 Linux


Disk /dev/mapper/3600508e00000000017cd3aa6870c460a: 999.7 GB,121534 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: 0x000a65a6


                    Device Boot   Start     End   Blocks  Id System
/dev/mapper/3600508e00000000017cd3aa6870c460ap1        1   121534  976221823+ 83 Linux


对sdb1进行格式化,无法进行格式化,提示如下
[root@ovirt-host ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

解决方法

通过dm解决问题,查看dm状态,显示dm设备信息
[root@ovirt-host ~]# dmsetup status
3600508e00000000017cd3aa6870c460a: 0 1952448512 multipath 2 0 0 0 1 1 A 0 1 0 8:16 A 0 

删除dm信息,并再次查看dm状态信息
[root@ovirt-host ~]# dmsetup remove_all
[root@ovirt-host ~]# dmsetup status
No devices found

此次dm已经找不到设备,再次通过fdisk查看磁盘信息,已经没有dm设备信息了

[root@ovirt-host ~]# fdisk -l;

Disk /dev/sda: 999.7 GB,121534 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: 0x000d16e8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131        4211    32768000   82  Linux swap / Solaris
/dev/sda3            4211      121535   942406656   83  Linux

Disk /dev/sdb: 999.7 GB,121534 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: 0x000a65a6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121534   976221823+  83  Linux

此时在对sdb1进行格式化操作

[root@ovirt-host ~]# mkfs.xfs /dev/sdb1
Meta-data=/dev/sdb1              isize=256    agcount=4,agsize=61013864 blks
         =                       sectsz=512   attr=2,projid32bit=0
data     =                       bsize=4096   blocks=244055455,imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=119167,version=2
         =                       sectsz=512   sunit=0 blks,lazy-count=1
realtime =none                   extsz=4096   blocks=0,rtextents=0
原文链接:https://www.f2er.com/centos/380895.html

猜你在找的CentOS相关文章