18.11. 访​​​​​​​问​​​​​​​客​​​​​​​户​​​​​​​机​​​​​​​磁​​​​​​​盘​​​​​​​映​​​​​​​像​​​​​​​里​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​

你​​​​​​​可​​​​​​​以​​​​​​​使​​​​​​​用​​​​​​​两​​​​​​​个​​​​​​​单​​​​​​​独​​​​​​​的​​​​​​​程​​​​​​​序​​​​​​​来​​​​​​​访​​​​​​​问​​​​​​​客​​​​​​​户​​​​​​​机​​​​​​​磁​​​​​​​盘​​​​​​​映​​​​​​​像​​​​​​​里​​​​​​​的​​​​​​​数​​​​​​​据​​​​​​​。​​​​​​​在​​​​​​​使​​​​​​​用​​​​​​​这​​​​​​​些​​​​​​​工​​​​​​​具​​​​​​​之​​​​​​​前​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​关​​​​​​​闭​​​​​​​客​​​​​​​户​​​​​​​机​​​​​​​。​​​​​​​从​​​​​​​客​​​​​​​户​​​​​​​机​​​​​​​和​​​​​​​ dom0 访​​​​​​​问​​​​​​​文​​​​​​​件​​​​​​​系​​​​​​​统​​​​​​​有​​​​​​​可​​​​​​​能​​​​​​​损​​​​​​​害​​​​​​​你​​​​​​​的​​​​​​​系​​​​​​​统​​​​​​​。​​​​​​​
你​​​​​​​可​​​​​​​以​​​​​​​使​​​​​​​用​​​​​​​ kpartx 程​​​​​​​序​​​​​​​来​​​​​​​处​​​​​​​理​​​​​​​分​​​​​​​区​​​​​​​磁​​​​​​​盘​​​​​​​或​​​​​​​ LVM 卷​​​​​​​组​​​​​​​:
yum install kpartx
kpartx -av /dev/xen/guest1
add map guest1p1 : 0 208782 linear /dev/xen/guest1 63
add map guest1p2: 0 16563015 linear /dev/xen/guest1 208845
要​​​​​​​访​​​​​​​问​​​​​​​另​​​​​​​一​​​​​​​个​​​​​​​分​​​​​​​区​​​​​​​的​​​​​​​ LVM 卷​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​用​​​​​​​ vgscan 对​​​​​​​ LVM 进​​​​​​​行​​​​​​​重​​​​​​​新​​​​​​​扫​​​​​​​描​​​​​​​并​​​​​​​用​​​​​​​ vgchange -ay 命​​​​​​​令​​​​​​​激​​​​​​​活​​​​​​​那​​​​​​​个​​​​​​​分​​​​​​​区​​​​​​​上​​​​​​​的​​​​​​​卷​​​​​​​组​​​​​​​(缺​​​​​​​省​​​​​​​为​​​​​​​ VolGroup00):
# kpartx -a /dev/xen/guest1
#vgscan
Reading all physical volumes . This may take a while...
Found volume group "VolGroup00" using metadata type 1vm2
# vgchange -ay VolGroup00
2 logical volume(s) in volume group VolGroup00 now active.
# lvs
LV VG Attr Lsize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-a- 5.06G
LogVol01 VolGroup00 -wi-a- 800.00M
# mount /dev/VolGroup00/LogVol00 /mnt/
....
#umount /mnt/
#vgchange -an VolGroup00
#kpartx -d /dev/xen/guest1
你​​​​​​​必​​​​​​​须​​​​​​​记​​​​​​​住​​​​​​​用​​​​​​​ vgchange -an 来​​​​​​​使​​​​​​​逻​​​​​​​辑​​​​​​​卷​​​​​​​无​​​​​​​效​​​​​​​、​​​​​​​用​​​​​​​ kpartx-d 来​​​​​​​删​​​​​​​除​​​​​​​分​​​​​​​区​​​​​​​且​​​​​​​在​​​​​​​完​​​​​​​成​​​​​​​后​​​​​​​用​​​​​​​ losetup -d 删​​​​​​​除​​​​​​​回​​​​​​​路​​​​​​​设​​​​​​​备​​​​​​​。​​​​​​​

为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。