<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=Virt%2FRawDisk</id>
	<title>Virt/RawDisk - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=Virt%2FRawDisk"/>
	<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=Virt/RawDisk&amp;action=history"/>
	<updated>2026-07-07T20:38:52Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wikiold.home.tartarefr.eu/index.php?title=Virt/RawDisk&amp;diff=2556&amp;oldid=prev</id>
		<title>Didier : Page créée avec « == Accéder à des données sur un disque virtuel (RAW) ==  On va monter notre image du disque sur la boucle locale &lt;syntaxhighlight lang=&quot;bash&quot;&gt; losetup /dev/loop0 /var/l... »</title>
		<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=Virt/RawDisk&amp;diff=2556&amp;oldid=prev"/>
		<updated>2013-11-29T10:01:33Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « == Accéder à des données sur un disque virtuel (RAW) ==  On va monter notre image du disque sur la boucle locale &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; losetup /dev/loop0 /var/l... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Accéder à des données sur un disque virtuel (RAW) ==&lt;br /&gt;
&lt;br /&gt;
On va monter notre image du disque sur la boucle locale&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
losetup /dev/loop0 /var/lib/xen/images/spacewalk.img&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
On va ensuite visualiser le partitionnement de celui-ci.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fdisk -lu /dev/loop0&lt;br /&gt;
Disk /dev/loop0: 25.8 GB, 25769803776 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 3133 cylinders, total 50331648 sectors&lt;br /&gt;
Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disk identifier: 0x000a0311&lt;br /&gt;
&lt;br /&gt;
      Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/loop0p1   *        2048      411647      204800   83  Linux&lt;br /&gt;
/dev/loop0p2          411648     2508799     1048576   82  Linux swap / Solaris&lt;br /&gt;
/dev/loop0p3         2508800    50331647    23911424   8e  Linux LVM&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
On peut remarquer&lt;br /&gt;
* La taille d&amp;#039;un secteur est de 512 octets&lt;br /&gt;
* Le disque comporte trois partitions&lt;br /&gt;
** Une partition linux commençant au secteur 2048, très probablement la partition /&amp;lt;path&amp;gt;boot&amp;lt;/path&amp;gt;&lt;br /&gt;
** Une partition de swap commençant au secteur 411648&lt;br /&gt;
** Une partition contenant un partitionnemnt LVM commençant au secteur 2508800&lt;br /&gt;
&lt;br /&gt;
On peut donc maintenant démonter notre disque&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
losetup -d /dev/loop0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Cette fois, on va monter la partition contenant LVM. Pour ce faire, on va monter l&amp;#039;image disque avec un offset. Celui-ci ne peut être défini qu&amp;#039;en octets et non en secteur. Comme on est fainéant, c&amp;#039;est bash qui fera la calcul.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
losetup -o $((512*2508800)) /dev/loop0 /var/lib/xen/images/spacewalk.img &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si le groupe de volume virtuel a le même nom sur le Dom0 et le disque virtuel, il faut le renommer&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vgscan&lt;br /&gt;
  Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;vg0&amp;quot; using metadata type lvm2&lt;br /&gt;
  Found volume group &amp;quot;vg0&amp;quot; using metadata type lvm2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vgdisplay&lt;br /&gt;
  --- Volume group ---&lt;br /&gt;
  VG Name               vg0&lt;br /&gt;
  System ID             &lt;br /&gt;
  Format                lvm2&lt;br /&gt;
  Metadata Areas        1&lt;br /&gt;
  Metadata Sequence No  111&lt;br /&gt;
  VG Access             read/write&lt;br /&gt;
  VG Status             resizable&lt;br /&gt;
  MAX LV                0&lt;br /&gt;
  Cur LV                4&lt;br /&gt;
  Open LV               3&lt;br /&gt;
  Max PV                0&lt;br /&gt;
  Cur PV                1&lt;br /&gt;
  Act PV                1&lt;br /&gt;
  VG Size               134,91 GiB&lt;br /&gt;
  PE Size               32,00 MiB&lt;br /&gt;
  Total PE              4317&lt;br /&gt;
  Alloc PE / Size       3904 / 122,00 GiB&lt;br /&gt;
  Free  PE / Size       413 / 12,91 GiB&lt;br /&gt;
  VG UUID               oZKl9P-AU3D-PmTr-CkR3-CY0r-jMiZ-mGr2fn&lt;br /&gt;
   &lt;br /&gt;
  --- Volume group ---&lt;br /&gt;
  VG Name               vg0&lt;br /&gt;
  System ID             &lt;br /&gt;
  Format                lvm2&lt;br /&gt;
  Metadata Areas        1&lt;br /&gt;
  Metadata Sequence No  6&lt;br /&gt;
  VG Access             read/write&lt;br /&gt;
  VG Status             resizable&lt;br /&gt;
  MAX LV                0&lt;br /&gt;
  Cur LV                4&lt;br /&gt;
  Open LV               0&lt;br /&gt;
  Max PV                0&lt;br /&gt;
  Cur PV                1&lt;br /&gt;
  Act PV                1&lt;br /&gt;
  VG Size               22,78 GiB&lt;br /&gt;
  PE Size               32,00 MiB&lt;br /&gt;
  Total PE              729&lt;br /&gt;
  Alloc PE / Size       640 / 20,00 GiB&lt;br /&gt;
  Free  PE / Size       89 / 2,78 GiB&lt;br /&gt;
  VG UUID               jUvBHs-xUtw-FNVA-M3Wn-iqB2-0HNr-8clONi&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vgrename jUvBHs-xUtw-FNVA-M3Wn-iqB2-0HNr-8clONi vg01&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{Admon/warning|Modification du nom du VG|Il va falloir mettre à jour le fichier &amp;lt;path&amp;gt;/etc/fstab&amp;lt;/path&amp;gt; sur le disque virtuel}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vgscan&lt;br /&gt;
  Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;vg0&amp;quot; using metadata type lvm2&lt;br /&gt;
  Found volume group &amp;quot;vg01&amp;quot; using metadata type lvm2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
On créer notre point de montage temporaire&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /mnt/tmp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
On visualise nos volumes logiques LVM&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lvscan&lt;br /&gt;
  ACTIVE            &amp;#039;/dev/vg0/lv0&amp;#039; [5,00 GiB] inherit&lt;br /&gt;
  ACTIVE            &amp;#039;/dev/vg0/lv1&amp;#039; [4,00 GiB] inherit&lt;br /&gt;
  ACTIVE            &amp;#039;/dev/vg0/lv2&amp;#039; [103,00 GiB] inherit&lt;br /&gt;
  ACTIVE            &amp;#039;/dev/vg0/lv3&amp;#039; [10,00 GiB] inherit&lt;br /&gt;
  inactive          &amp;#039;/dev/vg01/lv0&amp;#039; [5,00 GiB] inherit&lt;br /&gt;
  inactive          &amp;#039;/dev/vg01/lv1&amp;#039; [3,00 GiB] inherit&lt;br /&gt;
  inactive          &amp;#039;/dev/vg01/lv2&amp;#039; [10,00 GiB] inherit&lt;br /&gt;
  inactive          &amp;#039;/dev/vg01/lv3&amp;#039; [2,00 GiB] inherit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Celles du disque virtuel sont désactivées.&lt;br /&gt;
&lt;br /&gt;
On active notre partition LVM&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lvchange -a y /dev/vg01/lv0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
On monte notre partition LVM&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/vg01/lv0 /mnt/tmp/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On peut maintenant accéder à nos données&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vim /mnt/tmp/etc/fstab &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Une fois fini, on démonte notre volume logique&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
umount /dev/vg01/lv0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On le désactive car sinon on ne peut pas démonter notre boucle locale&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lvchange -a n /dev/vg01/lv0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On démonte notre boucle locale&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
losetup -d /dev/loop0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Didier</name></author>
	</entry>
</feed>