Difference between revisions of "Vnx-modify-rootfs"

From VNX
Jump to: navigation, search
(Mount the root filesystem from the host)
(Mount the root filesystem from the host)
Line 25: Line 25:
 
Examples:
 
Examples:
 
* Ubuntu rootfs
 
* Ubuntu rootfs
 +
<pre>
 +
#modprobe nbd
 +
# qemu-nbd -c /dev/nbd0 vnx_rootfs_kvm_ubuntu-12.04-v024.qcow2
 +
# fdisk -l /dev/nbd0
  
 +
Disco /dev/nbd0: 8589 MB, 8589934592 bytes
 +
255 cabezas, 63 sectores/pista, 1044 cilindros, 16777216 sectores en total
 +
Unidades = sectores de 1 * 512 = 512 bytes
 +
Tamaño de sector (lógico / físico): 512 bytes / 512 bytes
 +
Tamaño E/S (mínimo/óptimo): 512 bytes / 512 bytes
 +
Identificador del disco: 0x0000e82c
 +
 +
Dispositivo Inicio    Comienzo      Fin      Bloques  Id  Sistema
 +
/dev/nbd0p1  *        2048    15728639    7863296  83  Linux
 +
/dev/nbd0p2        15730686    16775167      522241    5  Extendida
 +
/dev/nbd0p5        15730688    16775167      522240  82  Linux swap / Solaris
 +
# mount /dev/nbd0p1 /mnt/
 +
...
 +
# umount /mnt
 +
# qemu-nbd -d /dev/nbd0
 +
/dev/nbd0 disconnected
 +
</pre>
  
 
* FreeBSD rootfs:
 
* FreeBSD rootfs:

Revision as of 01:23, 30 June 2013

Updating or modifying a VNX root filesystem


In order to update or modify a VNX root filesystem (rootfs from now on), you have two possible methods:

Mount the root filesystem from the host

The fastest way to modify a root filesystem is by mounting it from the host and directly modifying it without starting a virtual machine. To do that:

  • Create a ndb device with the filesystem:
  • modprobe nbd
    qemu-nbd -c /dev/nbd0 <rootfs_name>
    

    being <rootfs_name> the rootfs filename.

  • Consult the rootfs partitions with:
  • fdisk -l /dev/ndb0
    
  • Mount the desired partition with:
  • mount /dev/nbd0p1 /mnt
    
  • Do the modifications desired directly accesing files. You can chroot the the mount directory in order to install software.
  • At the end, unmount the particition and release nbd device:
  • umount /mnt
    qemu-nbd -d /dev/nbd0
    
      Examples:
      • Ubuntu rootfs
      #modprobe nbd
      # qemu-nbd -c /dev/nbd0 vnx_rootfs_kvm_ubuntu-12.04-v024.qcow2 
      # fdisk -l /dev/nbd0
      
      Disco /dev/nbd0: 8589 MB, 8589934592 bytes
      255 cabezas, 63 sectores/pista, 1044 cilindros, 16777216 sectores en total
      Unidades = sectores de 1 * 512 = 512 bytes
      Tamaño de sector (lógico / físico): 512 bytes / 512 bytes
      Tamaño E/S (mínimo/óptimo): 512 bytes / 512 bytes
      Identificador del disco: 0x0000e82c
      
      Dispositivo Inicio    Comienzo      Fin      Bloques  Id  Sistema
      /dev/nbd0p1   *        2048    15728639     7863296   83  Linux
      /dev/nbd0p2        15730686    16775167      522241    5  Extendida
      /dev/nbd0p5        15730688    16775167      522240   82  Linux swap / Solaris
      # mount /dev/nbd0p1 /mnt/
      ...
      # umount /mnt 
      # qemu-nbd -d /dev/nbd0
      /dev/nbd0 disconnected
      
      • FreeBSD rootfs:

    Start a virtual machine in direct mode

    To start a virtual machine directly mounting a rootfs and having Internet connection, you can use vnx command with the following parameters:

    vnx --modify_rootfs <rootfs_name>
    

    being <rootfs_name> the rootfs filename.

    Alternatively, you can create a libvirt XML virtual machine definition (see examples in /usr/share/vnx/examples directory) and start it using virsh:

    virsh create rootfs_XXX.xml
    

    and manually opening the console using:

    virt-viewer <vmname>
    

    being <vmname> the name assigned by libvirt to the virtual machine (you can get it with "virsh list" command).

    Once the virtual machine is started and you have access to the console, you can make the modifications desired.

    At the end, halt the virtual machine using the vnx_halt command. This will clean some log and history files, clean the apt cache and optionally leave a text message in /etc/vnx_rootfs_version describing the modifications done.

    Updating VNXACE daemon

    If you have a rootfs with the autoconfiguration and command execution daemon (ACE) already installed, you can use the autoupdate functionality to update the daemon to a newer version. Just follow this procedure:

    Linux and FreeBSD

    • Start the virtual machine with the following command line options:
    • vnx --modify-rootfs <rootfs_name> --update-aced -y
      

      being <rootfs_name> the rootfs filename. This command will try to update the VNXACE daemon to the latest version automatically (-y option).

    • If everything goes well, a message informing the new version installed will be shown in the virtual machine console before halting it.
    • If the daemon is not updated automatically, you can do it manually from inside the virtual machine:
      • Mounting the update disk:
      • mount /dev/sdb /mnt               # For Linux
        mount -t msdosfs /dev/ad1 /mnt    # For FreeBSD
        
      • Installing VNXACED:
      • perl /mnt/vnxaced-lf/install_vnxaced
        

    Windows

    To be completed

    Olive

    To be completed