/dev/sdxx is apparently in use by the system; will not make a

在存储上共享了一个500G的空间,映射到Linux系统提供上,环境由2个节点组成。 

一. 测试一: 直接mount

用fdisk 格式化之后如下:

[root@rac1 u01]# fdisk -l

……

Disk /dev/sdk: 536.8 GB, 536870912000 bytes

255 heads, 63 sectors/track, 65270cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Device Boot Start End Blocks Id System

/dev/sdk1 1 65270 524281243+ 83 Linux

……

[root@rac1u01]#

但是创建文件系统时报错:

[root@rac1 u01]# mkfs -t ext3 /dev/sdk1

mke2fs 1.39 (29-May-2006)

/dev/sdk1 isapparently in use by the system; will not make a filesystem here!

提示/dev/sdk1 正在被使用。 /dev/sdk1 正在被DM管理,所以我们创建文件系统时提示报错,我们手工的移除,就可以正常的创建文件系统,操作如下:

[root@rac1 u01]# dmsetup status

mpath2: 0 2097152 multipath 2 0 1 0 1 1 A 01 0 8:16 A 0

mpath11p1: 0 1048562487 linear

mpath9: 0 209715200 multipath 2 0 1 0 1 1 A0 1 0 8:128 A 0

mpath8: 0 629145600 multipath 2 0 1 0 1 1 A0 1 0 8:112 A 0

mpath7: 0 629145600 multipath 2 0 1 0 1 1 A0 1 0 8:96 A 0

mpath6: 0 2097152 multipath 2 0 1 0 1 1 A 01 0 8:80 A 0

mpath5: 0 2097152 multipath 2 0 1 0 1 1 A 01 0 8:64 A 0

mpath11: 0 1048576000 multipath 2 0 1 0 1 1A 0 1 0 8:160 A 0

mpath4: 0 2097152 multipath 2 0 1 0 1 1 A 01 0 8:48 A 0

mpath10: 0 209715200 multipath 2 0 1 0 1 1A 0 1 0 8:144 A 0

mpath3: 0 2097152 multipath 2 0 1 0 1 1 A 01 0 8:32 A 0

[root@rac1 u01]# dmsetup remove_all

[root@rac1 u01]# dmsetupstatus

No devices found

[root@rac1 u01]# mkfs -text3 /dev/sdk1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

65536000 inodes, 131070310 blocks

6553515 blocks (5.00%) reserved for thesuper user

First data block=0

Maximum filesystem blocks=4294967296

4000 block groups

32768 blocks per group, 32768 fragments pergroup

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

102400000

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystemaccounting information: done

This filesystem will be automaticallychecked every 36 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

--创建文件系统成功。

--mount 成功:

[root@rac1 u01]# mount /dev/sdk1/u01/backup

[root@rac1 u01]# df -lh

Filesystem Size Used Avail Use% Mounted on

/dev/sda3 59G 22G 35G 39% /

/dev/sda1 996M 51M 894M 6% /boot

tmpfs 32G 0 32G 0% /dev/shm

/dev/sda4 145G 188M 138G 1% /u01/dave

/dev/sdk1 493G 198M 467G 1% /u01/backup

--修改/etc/fstab 文件,让开机自动挂载:

[root@rac2 mapper]# vi /etc/fstab

LABEL=/ / ext3 defaults 1 1

LABEL=/boot /boot ext3 defaults 1 2

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

LABEL=SWAP-sda2 swap swap defaults 0 0

/dev/sdk1 /u01/backup ext3 defaults 0 0

但重启后测试,该文件不能正常挂载,手工挂载也会失败。

所以,这种解决方法不行。

补充内容:

Device mapper 是 Linux 2.6 内核中提供的一种从逻辑设备到物理设备的映射框架机制,在该机制下,用户可以很方便的根据自己的需要制定实现存储资源的管理策略,如条带化,镜像,快照等. 当前比较流行的 Linux 下的逻辑卷管理器如 LVM2(Linux Volume Manager 2 version)、EVMS(EnterpriseVolume Management System)、dmraid(Device Mapper RaidTool)等都是基于该机制实现的. 只要用户在用户空间制定好映射策略,按照自己的需要编写处理具体IO请求的 target driver插件,就可以很方便的实现这些特性.

Device Mapper主要包含内核空间的映射和用户空间的device mapper库及dmsetup工具.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/19884.html