Guest Disk Resize SOP

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Add SOP category.)
(add kvm info)
Line 12: Line 12:
 
Location: PHX, Tummy, ibiblio, Telia, OSUOSL
 
Location: PHX, Tummy, ibiblio, Telia, OSUOSL
  
Servers: All xen servers
+
Servers: All xen servers, kvm/libvirt servers.
  
 
Purpose: Resize guest disks
 
Purpose: Resize guest disks
  
 
== How to do it ==
 
== How to do it ==
 +
 +
=== Xen Guests ===
  
 
# SSH to the xen server and resize the guest's logical volume.  If you want to be extra careful, make a snapshot of the LV first: <pre>lvcreate -n [guest name]-snap -L 10G -s /dev/VolGroup00/[guest name] # Optional, but always good to be careful</pre><pre>lvresize -L [new total size]G /dev/VolGroup00/[guest name]</pre>
 
# SSH to the xen server and resize the guest's logical volume.  If you want to be extra careful, make a snapshot of the LV first: <pre>lvcreate -n [guest name]-snap -L 10G -s /dev/VolGroup00/[guest name] # Optional, but always good to be careful</pre><pre>lvresize -L [new total size]G /dev/VolGroup00/[guest name]</pre>
Line 26: Line 28:
 
# Check the size of the third partition: <pre>fdisk -l /dev/xvda3</pre>  If this still reflects the old size, then reboot the guest and verify that its size changed correctly when it comes up again.
 
# Check the size of the third partition: <pre>fdisk -l /dev/xvda3</pre>  If this still reflects the old size, then reboot the guest and verify that its size changed correctly when it comes up again.
 
# Login to the guest again, and run <pre>pvresize /dev/xvda3</pre>
 
# Login to the guest again, and run <pre>pvresize /dev/xvda3</pre>
 +
# A vgs should now show the new size.  Use lvresize to resize the root lv: <pre>lvresize -L [new root partition size]G /dev/GuestVolGroup00/root</pre>
 +
# Finally, resize the root partition: <pre>resize2fs /dev/GuestVolGroup00/root</pre>, verify that everything worked out, and delete the snapshot you made if you made one.
 +
 +
=== KVM/libvirt Guests ===
 +
 +
# SSH to the kvm server and resize the guest's logical volume.  If you want to be extra careful, make a snapshot of the LV first: <pre>lvcreate -n [guest name]-snap -L 10G -s /dev/VolGroup00/[guest name] # Optional, but always good to be careful</pre><pre>lvresize -L [new total size]G /dev/VolGroup00/[guest name]</pre>
 +
# Shutdown the guest and then start it up again: <pre>sudo virsh shutdown [guest name]</pre><pre>sudo virsh start [guest name]</pre>
 +
# Login into the guest: <pre>sudo virsh console [guest name]</pre>
 +
# On the guest, run <pre>fdisk /dev/sda</pre>
 +
# Delete the third partition (the LVM partition on the guest) and recreate it with the maximum size.  Make sure to set its type to LVM.
 +
# Run partprobe: <pre>partprobe</pre>
 +
# Check the size of the third partition: <pre>fdisk -l /dev/sda3</pre>  If this still reflects the old size, then reboot the guest and verify that its size changed correctly when it comes up again.
 +
# Login to the guest again, and run <pre>pvresize /dev/sda3</pre>
 
# A vgs should now show the new size.  Use lvresize to resize the root lv: <pre>lvresize -L [new root partition size]G /dev/GuestVolGroup00/root</pre>
 
# A vgs should now show the new size.  Use lvresize to resize the root lv: <pre>lvresize -L [new root partition size]G /dev/GuestVolGroup00/root</pre>
 
# Finally, resize the root partition: <pre>resize2fs /dev/GuestVolGroup00/root</pre>, verify that everything worked out, and delete the snapshot you made if you made one.
 
# Finally, resize the root partition: <pre>resize2fs /dev/GuestVolGroup00/root</pre>, verify that everything worked out, and delete the snapshot you made if you made one.
  
 
[[Category:Infrastructure SOPs]]
 
[[Category:Infrastructure SOPs]]

Revision as of 16:16, 6 May 2011

Infrastructure InfrastructureTeamN1.png


Shortcut:
ISOP:DRESIZE

Resize disks in our Xen guests

Contents

Contact Information

Owner: Fedora Infrastructure Team

Contact: #fedora-admin, sysadmin-main

Location: PHX, Tummy, ibiblio, Telia, OSUOSL

Servers: All xen servers, kvm/libvirt servers.

Purpose: Resize guest disks

How to do it

Xen Guests

  1. SSH to the xen server and resize the guest's logical volume. If you want to be extra careful, make a snapshot of the LV first:
    lvcreate -n [guest name]-snap -L 10G -s /dev/VolGroup00/[guest name] # Optional, but always good to be careful
    lvresize -L [new total size]G /dev/VolGroup00/[guest name]
  2. Shutdown the guest and then start it up again:
    xm shutdown -w [guest name]
    xm create [guest name]
  3. Login into the guest:
    xm console [guest name]
  4. On the guest, run
    fdisk /dev/xvda
  5. Delete the third partition (the LVM partition on the guest) and recreate it with the maximum size. Make sure to set its type to LVM.
  6. Run partprobe:
    partprobe
  7. Check the size of the third partition:
    fdisk -l /dev/xvda3
    If this still reflects the old size, then reboot the guest and verify that its size changed correctly when it comes up again.
  8. Login to the guest again, and run
    pvresize /dev/xvda3
  9. A vgs should now show the new size. Use lvresize to resize the root lv:
    lvresize -L [new root partition size]G /dev/GuestVolGroup00/root
  10. Finally, resize the root partition:
    resize2fs /dev/GuestVolGroup00/root
    , verify that everything worked out, and delete the snapshot you made if you made one.

KVM/libvirt Guests

  1. SSH to the kvm server and resize the guest's logical volume. If you want to be extra careful, make a snapshot of the LV first:
    lvcreate -n [guest name]-snap -L 10G -s /dev/VolGroup00/[guest name] # Optional, but always good to be careful
    lvresize -L [new total size]G /dev/VolGroup00/[guest name]
  2. Shutdown the guest and then start it up again:
    sudo virsh shutdown [guest name]
    sudo virsh start [guest name]
  3. Login into the guest:
    sudo virsh console [guest name]
  4. On the guest, run
    fdisk /dev/sda
  5. Delete the third partition (the LVM partition on the guest) and recreate it with the maximum size. Make sure to set its type to LVM.
  6. Run partprobe:
    partprobe
  7. Check the size of the third partition:
    fdisk -l /dev/sda3
    If this still reflects the old size, then reboot the guest and verify that its size changed correctly when it comes up again.
  8. Login to the guest again, and run
    pvresize /dev/sda3
  9. A vgs should now show the new size. Use lvresize to resize the root lv:
    lvresize -L [new root partition size]G /dev/GuestVolGroup00/root
  10. Finally, resize the root partition:
    resize2fs /dev/GuestVolGroup00/root
    , verify that everything worked out, and delete the snapshot you made if you made one.