添加完磁盘,并且分区后,执行格式化命令,报错:
/dev/sdc1 is apparently in use by the system; will not make a filesystem here!
/dec/sdc1正在被DM管理,所以我们创建文件系统时提示报错,我们手工的移除,就可以正常的创建文件系统,操作如下:
[root@rac1 ~]# cat /proc/partitions
major minor #blocks name
2 0 4 fd0
11 0 3763200 sr0
8 0 20971520 sda
8 1 512000 sda1
8 2 20458496 sda2
8 16 20971520 sdb
8 32 52428800 sdc
8 33 52428096 sdc1
8 48 20971520 sdd
8 49 1060258 sdd1
8 50 1060290 sdd2
8 51 18844245 sdd3
252 0 18423808 dm-0
252 1 2031616 dm-1
252 2 20971520 dm-2
252 3 52428800 dm-3
252 4 20971520 dm-4
252 5 1060258 dm-5
252 6 1060290 dm-6
252 7 18844245 dm-7
[root@rac1 ~]# dmsetup status
mpathd: 0 104857600 multipath 2 0 0 0 1 1 A 0 1 0 8:32 A 0
mpathc: 0 41943040 multipath 2 0 0 0 1 1 A 0 1 0 8:16 A 0
gwp3: 0 37688490 linear
gwp2: 0 2120580 linear
gwp1: 0 2120517 linear
vg_rac2-lv_swap: 0 4063232 linear
vg_rac2-lv_root: 0 36847616 linear
gw: 0 41943040 multipath 2 0 0 0 1 1 A 0 1 0 8:48 A 0
[root@rac1 ~]# dmsetup remove_all
[root@rac1 ~]# dmsetup status
vg_rac2-lv_swap: 0 4063232 linear
vg_rac2-lv_root: 0 36847616 linear
[root@rac1 ~]# mkfs.ext4 /dev/sdc1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107024 blocks
655351 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@rac1 ~]# dmsetup status
vg_rac2-lv_swap: 0 4063232 linear
vg_rac2-lv_root: 0 36847616 linear
[root@rac1 ~]# cat /proc/partitions
major minor #blocks name
2 0 4 fd0
11 0 3763200 sr0
8 0 20971520 sda
8 1 512000 sda1
8 2 20458496 sda2
8 16 20971520 sdb
8 32 52428800 sdc
8 33 52428096 sdc1
8 48 20971520 sdd
8 49 1060258 sdd1
8 50 1060290 sdd2
8 51 18844245 sdd3
252 0 18423808 dm-0
252 1 2031616 dm-1
补充内容:
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工具.