关于XenServer装好后挂载其它物理硬盘遇到的问题和解决方法

XenServer挂载不上错误提示如下:
The SR operation cannot be performed because a device underlying the SR is in use by the host.

这次遇到的XenServer挂载硬盘不成功的现象是这样:最开始全新4T硬盘挂在98上,一次成功,后研发部说97空间不够,要拆下挂到97上去,结果拆下后在97上死活也挂不上,然后发现重新挂载到原98物理机上也不行了。一样的错误。各种尝试均无效。比如把硬盘接到PE上清空SMART,清空mbr,清空GPT,不行。在Linux命令行下parted重新gpt分区,格式化并挂载到文件系统都成功。但就是用xe sr-create无法挂载,后拿了一块全新未拆封的2T未初始化的硬盘挂载一次就成功了。

最终得出结论:XenServer用xe sr-create命令挂载其它物理硬盘。除非硬盘是全新未初始化的。否则无法挂载。

自己也没搞懂普通用过的硬盘要如何回到刚买回来全新未初始化的状态!如果有知道的同学请留言告诉我,谢谢!

(自己最开始也是怀疑是这个原因。在PE下用了各种硬盘分区工具初始化,如:dg,傲梅等,清分区表,删除主引导。都不行。也就是磁盘状态无法达到全新未初始化的状态!)

 

正常XenServer挂载其它物理硬盘是这样的

xe XenServer 挂载其它硬盘
1、用命令查看下自己的host-uuid
[root@xenserver-arscyqkc ~]# xe host-list

2、查看所有硬盘的id
[root@xenserver-arscyqkc ~]# ls -l /dev/disk/by-id/
(一般都是sda,sdb等等)

3、挂载第2块硬盘到系统中,挂载成功会返回新存储的UUID
[root@xenserver-arscyqkc ~]# xe sr-create host-uuid=a9063198-c015-4a2c-bc86-4c1ba5c0dcd0 content-type=user type=lvm device-config:device=/dev/sda shared=false name-label="Disk 2" sm-config:allocation=thin

--120挂载第一块4T
xe sr-create host-uuid=d9744233-c798-46e1-86fa-ebb16f387a8f content-type=user type=lvm device-config:device=/dev/sdb shared=false name-label="Disk 2" sm-config:allocation=thin

--120挂载第二块4T
xe sr-create host-uuid=d9744233-c798-46e1-86fa-ebb16f387a8f content-type=user type=lvm device-config:device=/dev/sdc shared=false name-label="Disk 3" sm-config:allocation=thin

--98挂载第三块硬盘4T
xe sr-create host-uuid=31d2f109-7fe3-46b4-9f94-ed763356c08a content-type=user type=lvm device-config:device=/dev/sdc shared=false name-label="Disk_98-4T" sm-config:allocation=thin


通过ID挂载
xe sr-create name-label="4T-2" type=lvm content-type=user device-config:device=/dev/disk/by-id/ata-WDC_WD40EJRX-89T1XY0_WD-WCC7K0PNEEP1 host-uuid=a9063198-c015-4a2c-bc86-4c1ba5c0dcd0


4、挂载第2块硬盘到系统中成功后会返回新存储的UUID
7ad2ec79-3998-e2fd-b9a0-d82e21b1d76e

可以通过=/dev/disk/by-path/
 by-id 
by-uuid
xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-path/pci-0000:06:00.0-sas-phy2-lun-0 name-label="Disk 2-4T" host-uuid=a9063198-c015-4a2c-bc86-4c1ba5c0dcd0

查看磁盘列表命令:fdisk -l

成功挂载截图

posted @ 2022-10-04 00:14  IT情深  阅读(197)  评论(0编辑  收藏  举报