溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

解決"/dev/sdX is apparently in use by the systemwill not make a filesystem here"

發(fā)布時間:2020-08-04 15:08:12 來源:ITPUB博客 閱讀:796 作者:迷倪小魏 欄目:建站服務器

Linux上配置multipath,在HP EVA存儲上劃分一個100G大小的LUN,然后把它映射給Linux主機,將該100G空間使用fdisk進行分區(qū),分為3個區(qū)(關(guān)于Linux multipath多路徑配置與使用案例請參考作者的另一篇博文:http://blog.itpub.net/31015730/viewspace-2146732/

 

[root@seaing mapper]# cat /proc/partitions

major minor  #blocks  name

 

   8     0  488386584 sda

   8     1     104391 sda1

   8     2  488279610 sda2

   8    16  104857600 sdb

   8    17   48837568 sdb1

   8    18   29302560 sdb2

   8    19   19543072 sdb3

   8    32  209715200 sdc

   8    48  104857600 sdd

   8    49   48837568 sdd1

   8    50   29302560 sdd2

   8    51   19543072 sdd3

   8    64  209715200 sde

   8    80  104857600 sdf

   8    81   48837568 sdf1

   8    82   29302560 sdf2

   8    83   19543072 sdf3

   8    96  209715200 sdg

   8   112  104857600 sdh

   8   113   48837568 sdh2

   8   114   29302560 sdh3

   8   115   19543072 sdh4

   8   128  209715200 sdi

 253     0  469794816 dm-0

 253     1   18481152 dm-1

 253     2  104857600 dm-2

 253     3  209715200 dm-3

 

但是在格式化文件系統(tǒng)的時候,出現(xiàn)了報錯

[root@seaing mapper]# mkfs.ext3 /dev/sdb1

mke2fs 1.39 (29-May-2006)

/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

 

 

提示/dev/sdb1 正在被使用。 /dev/sdb1 正在被DM管理,所以我們創(chuàng)建文件系統(tǒng)時提示報錯,我們手工的移除,就可以正常的創(chuàng)建文件系統(tǒng),具體操作如下:

 

[root@seaing mapper]# dmsetup status

mpath3: 0 419430400 multipath 2 0 0 0 2 1 A 0 2 0 8:64 A 0 8:128 A 0 E 0 2 0 8:32 A 0 8:96 A 0

mpath2: 0 209715200 multipath 2 0 0 0 2 1 A 0 2 0 8:16 A 0 8:80 A 0 E 0 2 0 8:48 A 0 8:112 A 0

VolGroup00-LogVol01: 0 36962304 linear

VolGroup00-LogVol00: 0 939589632 linear

 

[root@seaing mapper]# mkdir /dev/mapper/mpath2 /comsys/

mkdir: cannot create directory `/dev/mapper/mpath2': File exists

mkdir: cannot create directory `/comsys/': File exists

[root@seaing mapper]#

[root@seaing mapper]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                      434G  4.9G  407G   2% /

/dev/sda1              99M   18M   77M  19% /boot

tmpfs                 7.9G     0  7.9G   0% /dev/shm

[root@seaing mapper]#

[root@seaing mapper]#

[root@seaing mapper]# mount /dev/mapper/mpath2 /comsys/

mount: you must specify the filesystem type

 

[root@seaing mapper]# mount /dev/sdb1 /comsys/

mount: /dev/sdb1 already mounted or /comsys/ busy

 

 

刪除映射關(guān)系,取消映射

[root@seaing mapper]# dmsetup remove_all(或dmsetup remove mpath2

[root@seaing mapper]#

[root@seaing mapper]# dmsetup status

VolGroup00-LogVol01: 0 36962304 linear

VolGroup00-LogVol00: 0 939589632 linear

[root@seaing mapper]#

[root@seaing mapper]# ll /dev/mapper

total 0

crw------- 1 root root  10, 63 Oct 24 18:02 control

brw-rw---- 1 root disk 253,  0 Oct 24 18:02 VolGroup00-LogVol00

brw-rw---- 1 root disk 253,  1 Oct 24 18:02 VolGroup00-LogVol01

 

 

再次創(chuàng)建文件系統(tǒng),創(chuàng)建成功

[root@seaing mapper]# mkfs.ext3 /dev/sdb1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

6111232 inodes, 12209392 blocks

610469 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

373 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

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

        4096000, 7962624, 11239424

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 33 mounts or

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

 

 

掛載成功

[root@seaing mapper]# mount /dev/sdb1 /comsys/

[root@seaing mapper]#

[root@seaing mapper]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                      434G  4.9G  407G   2% /

/dev/sda1              99M   18M   77M  19% /boot

tmpfs                 7.9G     0  7.9G   0% /dev/shm

/dev/sdb1              46G  181M   44G   1% /comsys

 

 

設(shè)置為開機掛載

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

/dev/VolGroup00/LogVol00 /                       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

/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

/dev/sdb1             /comsys                  ext3  defaults        0 0

 

 

重新啟動操作系統(tǒng),查看自動掛載是否成功

[root@seaing /]# reboot

 

Broadcast message from root (pts/1) (Wed Oct 25 10:16:35 2017):

 

The system is going down for reboot NOW!

Last login: Wed Oct 25 08:54:28 2017 from 10.1.1.44

 

[root@seaing ~]# cd /dev/mapper/

[root@seaing mapper]#

[root@seaing mapper]# ll

total 0

crw------- 1 root root  10, 63 Oct 25 10:19 control

brw-rw---- 1 root disk 253,  2 Oct 25 10:19 mpath2

brw-rw---- 1 root disk 253,  4 Oct 25 10:19 mpath2p1

brw-rw---- 1 root disk 253,  5 Oct 25 10:19 mpath2p2

brw-rw---- 1 root disk 253,  6 Oct 25 10:19 mpath2p3

brw-rw---- 1 root disk 253,  3 Oct 25 10:19 mpath3

brw-rw---- 1 root disk 253,  0 Oct 25 10:19 VolGroup00-LogVol00

brw-rw---- 1 root disk 253,  1 Oct 25 10:19 VolGroup00-LogVol01

[root@seaing mapper]#

[root@seaing mapper]# ll /dev/mpath/

total 0

lrwxrwxrwx 1 root root 7 Oct 25 10:19 mpath2 -> ../dm-2

lrwxrwxrwx 1 root root 7 Oct 25 10:19 mpath2p1 -> ../dm-4

lrwxrwxrwx 1 root root 7 Oct 25 10:19 mpath2p2 -> ../dm-5

lrwxrwxrwx 1 root root 7 Oct 25 10:19 mpath2p3 -> ../dm-6

lrwxrwxrwx 1 root root 7 Oct 25 10:19 mpath3 -> ../dm-3

 

 

重啟后測試,該文件不能正常掛載,手工掛載也會失敗。

[root@seaing mapper]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                      434G  4.9G  407G   2% /

/dev/sda1              99M   18M   77M  19% /boot

tmpfs                 7.9G     0  7.9G   0% /dev/shm

 

 

手動掛載也不能成功

[root@seaing mapper]# mount -a

mount: /dev/sdb1 already mounted or /comsys busy

 

 

所以說這種方法只能暫時性掛載,個人覺得不太不可?。。?!想要永久的進行掛載,還是按照作者的另一篇博文(http://blog.itpub.net/31015730/viewspace-2146732/)的方法進行比較穩(wěn)妥一點。


作者:SEian.G(苦練七十二變,笑對八十一難)

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI