Saturday, September 30, 2017

Debian Stretch: XEN part 1

Install minimum Debian Stretch and add some tools
# apt-get install net-tools
# apt-get install fail2ban
# apt-get install debian-goodies
# apt-get install ntp
# apt-get install dnsutils

Install Firmware
1. Add firmware repository
# vi /etc/apt/sources.list
# NON FREE
deb http://httpredir.debian.org/debian stretch main contrib non-free
# apt-get update 
2. Install firmware
# apt-get install firmware-linux-nonfree

To configure timezone
# dpkg-reconfigure tzdata

If your hardware use LSI RAID for my case Mega Raid, you need to monitor your disks status. Install this tool.
1. Add Raid tools repository
# wget https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key
# apt-key add ./hwraid.le-vert.net.gpg.key
# vi /etc/apt/sources.list
...
deb ​http://hwraid.le-vert.net/debian stretch main
...
# apt-get update 
2. Install Raid tools to monitor disks status.
# apt-get install megaraid-status
# megaraidsas-status
-- Arrays informations --
-- ID | Type | Size | Status
a0d0 | RAID 1 | 931GiB | optimal

-- Disks informations
-- ID | Model | Status | Warnings
a0e32s0 | SEAGATE ST1000NM0001 931GiB | online
a0e32s1 | SEAGATE ST1000NM0023 931GiB | online
a0e32s2 | SEAGATE ST1000NM0001 | ready
a0e32s3 | SEAGATE ST31000640SS 931GiB | predictive-failure

There is at least one disk/array in a NOT OPTIMAL state.

Install & configure LVM (Logical Volume Manager)
1. Install LVM2
# apt-get install lvm2 
2. Create Physical Volume on unused partition
# pvcreate /dev/sda5
WARNING: ext4 signature detected on /dev/sda5 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sda5.
  Physical volume "/dev/sda5" successfully created.
3. Create Volume Group
# vgcreate volGroup1 /dev/sda5
  Volume group "volGroup1" successfully created
# vgdisplay
  --- Volume group ---
  VG Name               volGroup1
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               784.78 GiB
  PE Size               4.00 MiB
  Total PE              200903
  Alloc PE / Size       0 / 0
  Free  PE / Size       200903 / 784.78 GiB
  VG UUID               LzgeKn-N4EO-R4mV-YbRB-6Utc-7GmB-F0ALs1

Install Xen 4.8 (default in stretch)
# apt-get install xen-system-amd64 xen-tools

Make prioritise boot xen kernel
# dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen
# update-grub
Including Xen overrides from /etc/default/grub.d/xen.cfg
WARNING: GRUB_DEFAULT changed to boot into Xen by default!
         Edit /etc/default/grub.d/xen.cfg to avoid this warning.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
done

Network configuration for bridge
# vi /etc/network/interfaces
# The primary network interface
auto eno1
iface eno1 inet manual

# Bridge
#allow-hotplug eno1
auto br0
iface br0 inet static
   address [your_ip]/24
   gateway [your_gateway]
   # dns-* options are implemented by the resolvconf package, if installed
   dns-nameservers 8.8.8.8 208.67.222.222
   bridge_ports eno1
# shutdown -r now

Edit /etc/xen/xl.conf to make bridge br0 as default network bridge
# vi /etc/xen/xl.conf
...
# default bridge device to use with vif-bridge hotplug scripts
#vif.default.bridge="xenbr0"
vif.default.bridge="br0"
...

Done! :)

Debian Stretch: XEN part 1
Debian Stretch: XEN configure & create DomU PV Debian part 3
Debian Stretch: XEN configure & create DomU HVM Centos part 2
Debian Stretch: XEN configure & create DomU PV ubuntu xenial part 4

To show memory:
# xl info | grep memory
total_memory           : 24530
free_memory            : 3122
sharing_freed_memory   : 0
sharing_used_memory    : 0

To show VCPU:
# xl info | grep cpu
nr_cpus                : 24
max_cpu_id             : 47
cpu_mhz                : 2000
free_cpus              : 0

To show volume group free space:
# vgdisplay | grep Free
  Free  PE / Size       71367 / 278.78 GiB

References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/ 
  2. https://wiki.debian.org/Firmware 
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/




No comments:

Post a Comment