Виртуальные жесткие диски в Xen

Виртуальные жесткие диски в XenВиртуальные жесткие диски в Xen доступны в самых различных вариациях. Многообразие свободного софта практически размывает границы и сценарии реализаций дисковой подсистемы для гостевых ОС. Получить представление о каждом варианте и научиться пользоваться ими может оказаться совсем не лишним. В этом вам и поможет данная статья.


Если вам интересна тематика Debian и связанных с ним приложений, рекомендую обратиться к тегу Debian на моем блоге.


Виртуальные жесткие диски в Xen

Как и многие другие компоненты Xen, дисковая подсистема для гостевых ОС также реализована на основе стороннего свободного софта 1. На данный момент наиболее широкое распространение получила файловая и LVM-реализация. По производительности они находятся примерно на одном и том же уровне, если для файловых устройств используется драйвер blktap 2. При этом файловый вариант предпочтительнее использовать для сред тестирования, а LVM — в продакшене, по крайней мере так разработчики заявили в документации 3:

We recommend blktap (a specialized form of file backend) and LVM for storage backends. These both work, offer good manageability, can be resized and moved freely, and support some mechanism for the sort of things we expect of filesystems now that we Live In The Future. blktap is easy to set up and good for testing, while LVM is scalable and good for production.

Разумеется администраторам Xen доступен вариант проброса физического устройства (например HDD) напрямую в гостевой домен, а также другие реализации виртуального хранилища на основе файлов (QCOW из пакета QEMU).

Вся дисковая подсистема гостей описывается в директории disk файла конфигурации гостевого домена. В общем виде секция имеет формат:

где diskspec — путь к диску и его настройки.

Примечание: исчерпывающая информация о конфигурации дисков доступна в официальной документации 4. В дальнейшем я буду целиком опираться на этот материал.

В зависимости от типа дисков, опции будут меняться, о чем я и расскажу ниже.

Виртуальные жесткие диски на основе файлов

Есть несколько ситуаций, в которых вам может понадобиться подключение файла как блочного устройства.

CD/DVD

Самый простейший и одновременно очень распространенный случай — подключение .iso-образа как CD/DVD-ROM для установки системы:

В примере выше я подключаю образ Windows Server.

Hdc — просто виртуальное устройство для гостевой системы (могут быть варианты hd[x], xvd[x], sd[x] и др.), с хостом оно никак не связано.

RAW

Создать такой диск в базовом варианте достаточно просто, даже не требуется никаких подготовительных действий. Просто выполните команду:

Или вот так (более предпочтительно):

Если виртуальный диск должен иметь большой объем (в примере выше объем всего 20ГБ), придется подождать пока файл заполнится нулями. При успешном завершении операции вы увидите что-то подобное:

Подключение тоже выглядит просто:

Выставлять принудительно формат raw совсем необязательно, он и так используется по умолчанию. Я же указал его просто для наглядности.

QEMU

Есть ещё один вариант создания файлов и использования их как виртуальных дисков — с помощью утилиты qemu-img 5 проекта QEMU 6. Используя формат qcow2 вы можете получить дополнительный полезный функционал, например copy on write 7 или снимки состояния.

Создать диск можно командой 8:

А в секции disk конфигурации гостевого домена прописать:

В данном случае указание формата обязательно. Диск будет динамически увеличивающимся.

Чтобы сделать снимок виртуального диска, достаточно выполнить команду:

При этом виртуальная машина должна быть отключена. Перед тем как её включить, вы должны изменить конфигурационный файл таким образом, чтобы настройки диска указывали на диск-снимок. Обратите внимание, что если вы измените диск-родитель, то все его снимки утратят работоспособность.

Примечание: не хочу вводить вас в заблуждение, но на данный момент работа со снимками виртуальной машины в Xen лично мной изучена недостаточно и я не буду утверждать, что создание снимка в реалтайме (live snapshot) невозможно. Во всяком случае QEMU такой функционал поддерживает 9. Остается не ясным лишь как обновить конфигурацию domU, чтобы перенаправить дисковые операции на диск-снимок и вернуть их обратно при удалении снимка.

Выше были рассмотрены все известные мне варианты реализации дисковой подсистемы на основе файлов.

Виртуальные жесткие диски на основе LVM

LVM является более надежным вариантом реализации дисковой подсистемы для domU, рассмотрим его подробно.

Подготовка

Подразумевается, что с LVM вы уже немного знакомы 10. Тем не менее, я рассмотрю все основные моменты от и до.

1. Предположим, что новый физический диск подключен к серверу. Первым делом необходимо его инициализировать, чтобы он распознавался LVM как физический том:

2. На следующем этапе нужно создать группу томов:

Примечание: группа томов может состоять из множества физических томов.

3. Теперь пришло время «нарезать» группу на логические тома. Если абстрагироваться от LVM и представить себе операции над обычным физическим диском, то на данном этапе идет создание логических разделов (например на диске /dev/sdc создаются /dev/sdc1 и /dev/sdc2). Не будем сразу тратить все свободное место, а выделим пока что 10ГБ:

где 2012R2Test01 — имя логического тома.

Конфигурация виртуальной машины

Конфигурация диска виртуальной машины в данном случае очень проста и практически не отличается от подключения каких-либо физических устройств:

Все действительно очень просто.

Снимки дисков

LVM, как известно, тоже поддерживает снимки. Сделать это можно командой:

В примере выше для логического тома /dev/vg0/2012R2Test01-Disk001 создается снимок (-s) с именем (-n) 2012R2Test01-Disk001-sn объемом (-L) 5Gb.

После создания снимка все операции ввода/вывода должны быть направлены на диск-снимок. В момент создания снимка виртуальная машина должна быть отключена, далее нужно в дисковой конфигурации этой ВМ указать диск-снимок вместо оригинального диска.

comments powered by HyperComments
writing papers
2022-07-05 14:47:12
<strong>find a dissertation https://professionaldissertationwriting.org/</strong>
dissertation chapters
2022-07-05 18:36:17
<strong>what is a dissertation paper https://professionaldissertationwriting.com/</strong>
writing phd dissertation
2022-07-05 21:12:48
<strong>cheap dissertation help in los angeles https://helpwithdissertationwritinglondon.com/</strong>
writing your dissertation
2022-07-05 23:58:42
<strong>doctoral dissertation help your https://dissertationwritingcenter.com/</strong>
dissertation proofreading services
2022-07-06 02:59:02
<strong>chicago illinois dissertation help https://dissertationhelpexpert.com/</strong>
writing your dissertation
2022-07-06 05:20:18
<strong>help with masters dissertation https://accountingdissertationhelp.com/</strong>
writing dissertations
2022-07-06 07:10:37
<strong>whats a dissertation https://examplesofdissertation.com/</strong>
writing my dissertation
2022-07-06 09:02:54
<strong>what is a dissertation https://writing-a-dissertation.net/</strong>
writing dissertation methodology
2022-07-06 12:16:51
<strong>best rated essay writing service https://bestdissertationwritingservice.net/</strong>
dissertations writing
2022-07-06 14:06:29
<strong>dissertation writing fellowships https://businessdissertationhelp.com/</strong>
premium dissertation writing service
2022-07-06 17:40:24
<strong>writing dissertation service https://customdissertationwritinghelp.com/</strong>
phd dissertation peer reviewing help
2022-07-06 22:30:07
<strong>doctoral dissertation https://writingadissertationproposal.com/</strong>
phd without dissertation
2022-07-06 23:15:06
<strong>help with masters dissertation https://dissertationhelpspecialist.com/</strong>
writing a dissertation methodology
2022-07-07 03:54:05
<strong>data analysis dissertation help https://dissertationhelperhub.com/</strong>
defending dissertation
2022-07-07 06:45:01
<strong>thesis defense https://customthesiswritingservices.com/</strong>
mgm pa online casino app
2022-07-25 20:08:13
<strong>raging bull online casino https://download-casino-slots.com/</strong>
golden dragon casino online
2022-07-25 21:11:07
<strong>online casino sign up bonus https://firstonlinecasino.org/</strong>
best online casino to win money
2022-07-25 23:22:08
<strong>online casino free spins no deposit https://onlinecasinofortunes.com/</strong>
casino live online
2022-07-26 02:17:53
<strong>best paying online casino https://newlasvegascasinos.com/</strong>
caesar casino online nj
2022-07-26 05:00:24
<strong>online caesars casino https://trust-online-casino.com/</strong>
usa online casino real money
2022-07-26 07:35:42
<strong>mgm pa online casino app https://onlinecasinosdirectory.org/</strong>
casino online usa
2022-07-26 10:32:55
<strong>online casino list https://9lineslotscasino.com/</strong>
online sweepstakes casino
2022-07-26 13:35:21
<strong>chumba casino online https://free-online-casinos.net/</strong>
casino stream online
2022-07-26 15:03:25
<strong>canadian online casino https://internet-casinos-online.net/</strong>
best online baccarat casino
2022-07-26 18:05:22
<strong>no deposit bonus win real money online casino for free https://cybertimeonlinecasino.com/</strong>
newest pa online casino
2022-07-26 20:03:09
<strong>borgata casino online login https://1freeslotscasino.com/</strong>
casino online usa real money
2022-07-27 00:08:02
<strong>lucky creek online casino https://vrgamescasino.com/</strong>
online casino bonus
2022-07-27 00:42:52
<strong>vegas casino online no deposit bonus https://casino-online-roulette.com/</strong>
no deposit online casino bonus codes
2022-07-27 03:27:36
<strong>ocean casino online https://casino-online-jackpot.com/</strong>
online casino florida
2022-07-27 08:50:29
<strong>online casino bonuses no deposit https://ownonlinecasino.com/</strong>
michigan online casino
2022-07-27 11:39:54
<strong>online casino game https://all-online-casino-games.com/</strong>
paradise casino online
2022-07-27 14:48:57
<strong>parx online free casino https://casino8online.com/</strong>
cyberghost vpn free trial
2022-08-07 18:27:48
<strong>express vpn https://shiva-vpn.com/</strong>
best vpn service review
2022-08-07 21:03:05
<strong>best vpn value https://freehostingvpn.com/</strong>
10 best vpn services
2022-08-07 21:53:55
<strong>free uk vpn https://ippowervpn.net/</strong>
best vpn for firefox
2022-08-08 03:09:57
<strong>buy pia vpn https://superfreevpn.net/</strong>
best vpn for firefox
2022-08-08 04:35:09
<strong>hide me vpn free https://free-vpn-proxy.com/</strong>
free vpn chrome
2022-08-08 06:44:31
<strong>free vpn download for windows https://rsvpnorthvalley.com/</strong>
stiges gay dating
2022-08-23 14:56:54
<strong>best gay dating apps https://gay-singles-dating.com/</strong>
hunter biden gay boyfriend dating
2022-08-23 17:43:18
<strong>gay dating sims https://gayedating.com/</strong>
best dating website
2022-08-24 12:17:57
<strong>online dating plus 50 https://freephotodating.com/</strong>
pof dating sites usa
2022-08-24 16:06:45
<strong>meet= dating dating https://onlinedatingbabes.com/</strong>
online singles dating sites
2022-08-24 20:53:29
<strong>pof dating website https://adult-classifieds-online-dating.com/</strong>
christian dating
2022-08-24 21:29:44
<strong>date website free https://online-internet-dating.net/</strong>
free adult dating sites
2022-08-25 01:03:11
<strong>dating personals free https://speedatingwebsites.com/</strong>
single dating
2022-08-25 03:30:39
<strong>free online dating service https://datingpersonalsonline.com/</strong>
single woman free
2022-08-25 05:22:43
<strong>local single women near me https://wowdatingsites.com/</strong>
online dating sites for free
2022-08-25 08:10:23
<strong>dating wites https://lavaonlinedating.com/</strong>
free dating sites for men and women
2022-08-25 09:01:55
<strong>dating for free https://freeadultdatingpasses.com/</strong>
a free dating site
2022-08-25 12:55:56
<strong>dating site free https://virtual-online-dating-service.com/</strong>
date internet site
2022-08-25 15:05:04
<strong>dating chat site https://zonlinedating.com/</strong>
interracial dating central
2022-08-25 15:52:23
<strong>free free https://onlinedatingservicesecrets.com/</strong>
mgm casino online
2022-08-30 09:28:20
<strong>resorts online casino bonus code https://onlinecasinos4me.com/</strong>
best online casino no deposit
2022-08-30 15:28:23
<strong>best online casino in canada https://online2casino.com/</strong>
online casino bookie
2022-08-30 18:16:56
<strong>mgm online casino michigan https://casinosonlinex.com/</strong>
free asain chat lines gay
2022-09-03 01:37:46
<strong>free gay chat nrooms https://newgaychat.com/</strong>
senior gay chat lines
2022-09-03 03:45:24
<strong>first time gay chat https://gaychatcams.net/</strong>
teen chat rooms 13-16 gay
2022-09-03 12:04:37
<strong>live gay chat https://gaychatspots.com/</strong>
free asian chat lines gay
2022-09-03 14:43:41
<strong>gay chat cam https://gay-live-chat.net/</strong>
gay guys into perv chat
2022-09-03 22:22:38
<strong>gay nude video chat https://chatcongays.com/</strong>
free seattle wa gay and bi mens chat sites
2022-09-04 05:35:16
<strong>aol chat room gay https://gaychatnorules.com/</strong>
chat de gay usa avenue
2022-09-04 14:07:01
<strong>free chat for gay curius people https://gaymusclechatrooms.com/</strong>
pittsburgh gay chat
2022-09-04 14:48:50
<strong>gay chat room carneys point https://free-gay-sex-chat.com/</strong>
reddit gay sex chat room
2022-09-04 23:13:46
<strong>gay furry chat one on one https://gayinteracialchat.com/</strong>
free gay and bi mens chat
2022-10-20 17:13:22
<strong>chat to gay https://gaymanchatrooms.com/</strong>
buy custom paper
2022-10-20 18:35:03
<strong>custom papers online https://term-paper-help.org/</strong>
order custom papers
2022-10-20 20:59:46
<strong>someone write my paper https://uktermpaperwriters.com/</strong>
custom papers writing
2022-10-20 22:16:50
<strong>write my paper for me in 3 hours https://paperwritinghq.com/</strong>
write my english paper for me
2022-10-20 23:42:06
<strong>college paper service https://writepapersformoney.com/</strong>
write my paper in apa format
2022-10-21 01:26:08
<strong>college paper writing services https://write-my-paper-for-me.org/</strong>
help writing paper
2022-10-21 02:23:16
<strong>order a paper online https://doyourpapersonline.com/</strong>
help me write a paper
2022-10-21 04:11:17
<strong>custom papers https://top100custompapernapkins.com/</strong>
academic paper writers
2022-10-21 08:11:10
<strong>custom papers for college https://writingpaperservice.net/</strong>
need help with paper
2022-10-21 10:52:24
<strong>websites to type papers https://mypaperwritinghelp.com/</strong>
pay someone to write paper
2022-10-21 12:17:37
<strong>write my college paper for me https://writemypaperquick.com/</strong>
where can i buy resume paper
2022-10-21 14:34:28
<strong>buy a literature review paper https://papercranewritingservices.com/</strong>
write my paper reviews
2022-10-21 15:47:16
<strong>custom papers for college https://premiumpapershelp.com/</strong>
buy college papers
2022-10-21 17:18:52
<strong>pay to write papers https://ypaywallpapers.com/</strong>
pay for someone to write your paper
2022-10-21 18:41:02
<strong>write my paper for cheap https://studentpaperhelp.com/</strong>
2jelsoft
2023-01-27 11:42:07
<strong>3sensitivity</strong>
coursework sample of written work
2023-02-05 17:22:13
<strong>coursework writing help https://writingacoursework.com/</strong>
coursework writing
2023-02-05 19:14:05
<strong>coursework planner https://mycourseworkhelp.net/</strong>
coursework writer
2023-02-05 20:05:58
<strong>creative writing coursework ideas https://courseworkdownloads.com/</strong>
coursework writing uk
2023-02-05 21:35:20
<strong>differential equations coursework https://courseworkinfotest.com/</strong>
courseworks help
2023-02-05 23:52:51
<strong>do my coursework online https://teachingcoursework.com/</strong>
coursework only degree
2023-02-06 01:39:07
<strong>buy coursework online https://buycoursework.org/</strong>
coursework papers
2023-02-06 02:37:59
<strong>coursework masters https://courseworkdomau.com/</strong>
absolutely free dating sites
2023-02-08 14:37:42
<strong>ourtime free trial https://jewish-dating-online.net/</strong>
dateing site
2023-02-08 16:09:27
<strong>free dating services online https://free-dating-sites-free-personals.com/</strong>
meet me now dating site
2023-02-08 18:06:18
<strong>ourtime dating https://sexanddatingonline.com/</strong>
single women phone numbers
2023-02-08 18:47:56
<strong>best dating site https://onlinedatingsurvey.com/</strong>
online dating sites for free
2023-02-08 19:52:00
<strong>positive single https://onlinedatingsuccessguide.com/</strong>
online sex dating
2023-02-08 20:52:07
<strong>japanese singles dating sites https://onlinedatinghunks.com/</strong>
local online dating
2023-02-08 23:23:27
<strong>new online dating sites https://datingwebsiteshopper.com/</strong>
searchingforsingles
2023-02-09 00:33:04
<strong>free online dating and personals https://allaboutdatingsites.com/</strong>
Яндекс.Метрика