linux格式化 in use,Centos下无法格式化硬盘/dev/sd* is apparently in use by the system; will not make a filesyste...

环境说明

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

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

小编个人微信号 jb51ccc

喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值