Changes between Initial Version and Version 1 of decommission_kvm


Ignore:
Timestamp:
May 11, 2012, 6:51:17 PM (13 years ago)
Author:
Ross
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • decommission_kvm

    v1 v1  
     1This page documents the steps to take in decommissioning a kvm guest.
     2
     3'''Make sure any needed data is backed up.'''
     4
     5The steps below assume that nothing needs to be preserved from the server.  If something does need to be preserved, copy the data to another location before following these steps.
     6
     7== Shutting down the guest ==
     8
     9We need the machine to be out of service so that we can wipe any sensitive data from the disks. In order to shutdown a guest so that it will not reboot, you'll need to be root@HOSTNAME.mayfirst.org.  From the host, issue the command:
     10
     11{{{
     12# update-service --remove /etc/sv/kvm/GUESTNAME
     13}}}
     14
     15This command will shutdown the virtual machine.  We need the machine to be out of service so that we can wipe any sensitive data from the disks.
     16
     17== Removing the guest directory ==
     18
     19To ensure that the guest will not come back online, ever, you should remove the guest kvm directory with the following command as root@HOSTNAME.mayfirst.org.
     20
     21{{{
     22# rm -rf /etc/sv/kvm/GUESTNAME
     23}}}
     24
     25== Ensure all sensitive data is overwritten ==
     26
     27For this step, login as GUESTNAME@HOSTNAME.mayfirst.org to ensure that you do not overwrite data for other guests.  Here we'll issue a dd command that writes zeros across the entire logical volume.  The command is:
     28
     29{{{
     30$ dd if=/dev/zero of=/dev/mapper/VOLUMEGROUPNAME-LOGICALVOLUMENAME bs=1M
     31}}}
     32
     33A real world example would be '''dd if=/dev/zero of=/dev/mapper/vg_ken0-bataille bs=1M'''
     34
     35Once this command finishes running, you can return the logical volume to the volume group.
     36
     37== Removing a Logical Volume ==
     38
     39From root@HOSTNAME.mayfirst.org check the volume group with:
     40
     41{{{
     42# vgs
     43}}}
     44
     45This should give output that looks like this:
     46
     47{{{
     480 ken:/dev# vgs
     49  VG      #PV #LV #SN Attr   VSize VFree
     50  vg_ken0   1  15   0 wz--n- 1.82t 1.10t
     510 ken:/dev#
     52}}}
     53
     54Now you can remove the logical volume with the following command:
     55
     56{{{
     57# lvremove VOLUMEGROUPNAME/LOGICALVOLUMENAME
     58}}}
     59
     60Real world example:
     61
     62{{{
     630 ken:/dev# lvremove vg_ken0/bataille
     64Do you really want to remove active logical volume bataille? [y/n]: y
     65  Logical volume "bataille" successfully removed
     660 ken:/dev#
     67}}}
     68
     69Now run 'vgs' again and make sure the new disk space has been added back to the volume group.  You should see an increase in the 'VFree' column of the output of the 'vgs' command.
     70
     71You've now decommissioned a server!