Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Aprire un terminale o sessione SSH e individuare il nuovo disco con il comando fdisk -l
Creare la partizione con il comando fdisk /dev/<nome del disco virtuale>, procedere come segue:
p + invio, non ci sono partizioni
n + invio, crea la nuova partizione
t + invio, impostare il tipo di partizione (Default 83 Linux)
w + invio, salva la nuova configurazione
Formattare la partizione in formato ext4 con il comando: mkfs.ext4 /dev/<nome specialfile>
Creare una cartella dove montare il nuovo disco virtuale, mkdir /home/<nome cartella>
Montare la cartella, mount /dev/<nome special file> <nome cartella>
Se tutto funziona correttamente, smontare la cartella e inserire permanentemente la mount in fstab
Condivisione Samba
Editare /etc/smb.conf e inserire la nuova condivisione
[<nome condivisione>]
path = /home/<nome cartella>
read only = no
# 1. stop the VM
# 2. move the current image
mv mykvm.img mykvm.img.bak
Now with the larger mykvm.img file in hand, boot gparted and extend the
existing partition into the newly added disk space. This last step
basically extends the OS partition so that it can make use of the extra
space.
Here are the steps that I roughly followed to resize a KVM guest that
used LVM internally.
Shutdown the VM
add more space to the guest's "image file" (something like: cat
old.img 10G_addon.raw >> new.img
start the VM (using the newly created new.img)
% fdisk /dev/vda
...
Device Boot Start End Blocks Id System
/dev/vda1 * 1 13 104391 83 Linux
/dev/vda2 14 3263 26105625 8e Linux LVM
WARNING: Re-reading the partition table failed with error 16: Device
or
resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
%
Reboot the VM
% pvdisplay
--- Physical volume ---
PV Name /dev/vda2
VG Name VolGroup00
PV Size 24.90 GB / not usable 21.59 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 796
Free PE 0
...
% pvresize /dev/vda2
% pvdisplay
--- Physical volume ---
PV Name /dev/vda2
VG Name VolGroup00
PV Size 44.90 GB / not usable 22.89 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 1436
Free PE 640
...
% resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line
resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to
11501568 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks
long.
Esempio:
lenny.img è il file immagine in formato raw che contiene i dati della
macchina virtuale (sia Xen o QEMU (eventualmente KVM).
Ora col comando mount si deve innestare il device map della prima
partizione su una directory del host. In questo caso è stato scelto /mnt
# umount /dev/mapper/loop0p1
Dissociare le partizioni dal device map:
# losetup -d /dev/loop0
# losetup -a