User Tools

Site Tools


haas:system:sokraits_halfadder.offbyone.lan

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:system:sokraits_halfadder.offbyone.lan [2014/08/07 15:49] – [Setting /etc/mdadm/mdadm.conf] wedgehaas:system:sokraits_halfadder.offbyone.lan [2014/10/04 14:41] (current) – [rsync to fileserver] wedge
Line 4: Line 4:
  
 ^  hostname  ^  RAM  ^  disk  ^  swap  ^  OS  ^  Kernel  ^ ^  hostname  ^  RAM  ^  disk  ^  swap  ^  OS  ^  Kernel  ^
-|  sokraits.lair.lan  |  8GB  |  32GB (/)  |  1.2GB  |  Debian 8.0 "Jessie" (AMD64)  |  3.14-2-amd64  |+|  sokraits.lair.lan  |  8GB  |  32GB (/)  |  1.2GB  |  Debian 8.0 "Jessie" (AMD64)  |  3.16-2-amd64  |
 |  :::  |  :::  |  500GB + 500GB RAID1 (/dev/md0)  |  :::  |  :::  |  :::  | |  :::  |  :::  |  500GB + 500GB RAID1 (/dev/md0)  |  :::  |  :::  |  :::  |
  
 ^  hostname  ^  RAM  ^  disk  ^  swap  ^  OS  ^  Kernel  ^ ^  hostname  ^  RAM  ^  disk  ^  swap  ^  OS  ^  Kernel  ^
-|  halfadder.lair.lan  |  8GB  |  32GB (/)  |  1.2GB  |  Debian 8.0 "Jessie" (AMD64)  |  3.14-2-amd64  |+|  halfadder.lair.lan  |  8GB  |  32GB (/)  |  1.2GB  |  Debian 8.0 "Jessie" (AMD64)  |  3.16-2-amd64  |
 |  :::  |  :::  |  500GB + 500GB RAID1 (/dev/md0)  |  :::  |  :::  |  :::  | |  :::  |  :::  |  500GB + 500GB RAID1 (/dev/md0)  |  :::  |  :::  |  :::  |
  
Line 21: Line 21:
   * Re-re-reinstalled sokraits with Debian Wheezy -> Jessie, due to failed boot drive (20140806)   * Re-re-reinstalled sokraits with Debian Wheezy -> Jessie, due to failed boot drive (20140806)
   * Re-installed halfadder with Debian Jessie (20140806)   * Re-installed halfadder with Debian Jessie (20140806)
 +  * Re-re-re-resetup sokraits as a clone of halfadder and netbooting with entire system in initrd, due to (another) failed boot drive (20141004)
 =====TODO==== =====TODO====
-  * rig up ramdisk /var and /tmp w/ periodic writes (since we have an SSD /).+  * <del>rig up ramdisk /var and /tmp w/ periodic writes (since we have an SSD /).</del> System runs in a RAMdisk.
   * find 3.5" to 5.25" drive brackets and remount sokraits data drives in case.   * find 3.5" to 5.25" drive brackets and remount sokraits data drives in case.
   * on next halfadder reboot, verify that OCFS2 /export gets mounted automatically (last time I had to run "/etc/init.d/ocfs2 restart" for it to do this).   * on next halfadder reboot, verify that OCFS2 /export gets mounted automatically (last time I had to run "/etc/init.d/ocfs2 restart" for it to do this).
Line 122: Line 123:
 =====apt configuration===== =====apt configuration=====
  
 +====use LAIR apt proxy====
 +To reduce traffic caused by package transactions, I set up a proxy on the fileserver(s), so every client will need to configure itself appropriately. Turns out this can be done most easily by creating the file **/etc/apt/apt.conf.d/00apt-cacher-ng** and putting in the following contents:
 +
 +<code>
 +Acquire::http { Proxy "http://10.80.1.3:3142"; };
 +</code>
 +
 +====no recommends====
 I wanted a small installation footprint, so I disabled the installation of recommended packages by default. I wanted a small installation footprint, so I disabled the installation of recommended packages by default.
  
Line 156: Line 165:
   ocfs2-tools   ocfs2-tools
   smartmontools   smartmontools
 +  firmware-realtek 
 +  qemu-system-x86-64
  
 =====GRUB Configuration===== =====GRUB Configuration=====
Line 269: Line 279:
 ## ##
 arch            = amd64 arch            = amd64
-#mirror         = http://mirror/debian/ 
 mirror          = http://ftp.us.debian.org/debian/ mirror          = http://ftp.us.debian.org/debian/
 mirror_squeeze  = http://ftp.us.debian.org/debian/ mirror_squeeze  = http://ftp.us.debian.org/debian/
-#mirror_squeeze = http://mirror/debian/ +mirror_wheezy   = http://ftp.us.debian.org/debian/ 
-mirror_wheezy   = http://mirror/debian/ +mirror_jessie   = http://ftp.us.debian.org/debian/ 
-#mirror_wheezy  = http://ftp.us.debian.org/debian/ + 
-#mirror_jessie  = http://ftp.us.debian.org/debian/ +###################################################################### 
-mirror_jessie   = http://mirror/debian/+## 
 +## Proxy Settings for repositories 
 +## 
 +apt_proxy       = http://10.80.1.3:3142/
  
 ###################################################################### ######################################################################
Line 365: Line 377:
 The purpose of the disk array is to provide RAID1 (mirror) to the Xen VM images. The purpose of the disk array is to provide RAID1 (mirror) to the Xen VM images.
  
 +====Re-initializing====
 +As we've had functioning RAID volumes for years, I thought I would re-do the arrays so as to take advantage of any new version features (when I first created them, mdadm was at version 0.8- now it is 1.2).
 +
 +So, I first stopped the array:
 +
 +<cli>
 +sokraits:~# mdadm --stop /dev/md0
 +</cli>
 +
 +Then, I zeroed out the superblocks on both constituent drives:
 +
 +<cli>
 +sokraits:~# mdadm --zero-superblock /dev/sdb
 +sokraits:~# mdadm --zero-superblock /dev/sdc
 +</cli>
 +
 +Now we can proceed with creating the new array.
 ====creating /dev/md0==== ====creating /dev/md0====
 I opted to build the array straight to disk-- no messing with partition tables. I opted to build the array straight to disk-- no messing with partition tables.
Line 370: Line 399:
 <cli prompt="# "> <cli prompt="# ">
 halfadder:~# mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb /dev/sdc  halfadder:~# mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb /dev/sdc 
-mdadm: partition table exists on /dev/sdb but will be lost or 
-       meaningless after creating array 
-mdadm: Note: this array has metadata at the start and 
-    may not be suitable as a boot device.  If you plan to 
-    store '/boot' on this device please ensure that 
-    your boot-loader understands md/v1.x metadata, or use 
-    --metadata=0.90 
-mdadm: partition table exists on /dev/sdc but will be lost or 
-       meaningless after creating array 
-Continue creating array? y 
-mdadm: Defaulting to version 1.2 metadata 
-mdadm: array /dev/md0 started. 
-halfadder:~#  
-</cli> 
- 
-<cli> 
-root@sokraits:/backup# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc 
 mdadm: /dev/sdb appears to be part of a raid array: mdadm: /dev/sdb appears to be part of a raid array:
        level=raid0 devices=0 ctime=Wed Dec 31 19:00:00 1969        level=raid0 devices=0 ctime=Wed Dec 31 19:00:00 1969
Line 403: Line 415:
 mdadm: Defaulting to version 1.2 metadata mdadm: Defaulting to version 1.2 metadata
 mdadm: array /dev/md0 started. mdadm: array /dev/md0 started.
 +halfadder:~# 
 </cli> </cli>
 +
 +
 ====checking disk array status==== ====checking disk array status====
 To check the status: To check the status:
Line 483: Line 498:
  
 # definitions of existing MD arrays # definitions of existing MD arrays
-ARRAY /dev/md/0 metadata=1.2 UUID=a0e64ddc:8cf6de4c:6e01f619:e9474564 name=halfadder:0+ARRAY /dev/md/0 metadata=1.2 UUID=c846eb24:6b9783db:cd9b436c:8470fd46 name=halfadder:0
  
 # This file was auto-generated on Wed, 06 Aug 2014 11:17:46 -0400 # This file was auto-generated on Wed, 06 Aug 2014 11:17:46 -0400
Line 493: Line 508:
  
 <cli prompt="# "> <cli prompt="# ">
-halfadder:~# /dev/md0:+halfadder:~# mdadm --detail /dev/md0 
 +/dev/md0:
         Version : 1.2         Version : 1.2
-  Creation Time : Wed Nov 17 16:43:40 2010+  Creation Time : Thu Aug  7 11:50:06 2014
      Raid Level : raid1      Raid Level : raid1
-     Array Size : 488385424 (465.76 GiB 500.11 GB) +     Array Size : 488255488 (465.64 GiB 499.97 GB) 
-  Used Dev Size : 488385424 (465.76 GiB 500.11 GB)+  Used Dev Size : 488255488 (465.64 GiB 499.97 GB)
    Raid Devices : 2    Raid Devices : 2
   Total Devices : 2   Total Devices : 2
     Persistence : Superblock is persistent     Persistence : Superblock is persistent
  
-    Update Time : Wed Aug  6 16:50:50 2014 +  Intent Bitmap : Internal 
-          State : clean + 
 +    Update Time : Thu Aug  7 13:11:52 2014 
 +          State : active 
  Active Devices : 2  Active Devices : 2
 Working Devices : 2 Working Devices : 2
Line 511: Line 529:
  
            Name : halfadder: (local to host halfadder)            Name : halfadder: (local to host halfadder)
-           UUID : a0e64ddc:8cf6de4c:6e01f619:e9474564 +           UUID : c846eb24:6b9783db:cd9b436c:8470fd46 
-         Events : 1568+         Events : 979
  
     Number   Major   Minor   RaidDevice State     Number   Major   Minor   RaidDevice State
Line 526: Line 544:
  
 <cli prompt="# "> <cli prompt="# ">
-BOTH:~# rm -f /var/lib/mdadm/CONF-UNCHECKED 
 BOTH:~# update-initramfs -t -u -k all BOTH:~# update-initramfs -t -u -k all
 update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64 update-initramfs: Generating /boot/initrd.img-2.6.32-5-xen-amd64
Line 537: Line 554:
 With the tools installed, we need to configure some files. With the tools installed, we need to configure some files.
  
-====/etc/drbd.conf BEFORE==== +====/etc/drbd.d/global_common.conf BEFORE==== 
-First up, we need to get the peers talking so we can form the volume and get OCFS2 established. Let's make the **/etc/drbd.conf** look as follows:+First up, we need to get the peers talking so we can form the volume and get OCFS2 established. Let's make the **/etc/drbd.d/global_common.conf** file look as follows:
  
 <code> <code>
Line 566: Line 583:
     protocol C;     protocol C;
 } }
 +</code>
  
 +This is only an intermediate step. Further changes are needed before we can bring it up in dual-primary mode.
 +
 +====/etc/drbd.d/xen_data.res====
 +And the resource configuration (doesn't need to change), on both peers:
 +
 +<code>
 resource xen_data resource xen_data
 { {
 +    device      /dev/drbd0;
 +    disk        /dev/md0;
 +    meta-disk   internal;
 +
     on sokraits     on sokraits
     {     {
-        device      /dev/drbd0; +        address     172.16.1.1:7788;
-        disk        /dev/md0; +
-        address     172.16.2.1:7789; +
-        meta-disk   internal;+
     }     }
  
     on halfadder     on halfadder
     {     {
-        device      /dev/drbd0; +        address     172.16.1.2:7788;
-        disk        /dev/md0; +
-        address     172.16.2.2:7789; +
-        meta-disk   internal;+
     }     }
 } }
 </code> </code>
- 
-This is only an intermediate step. Further changes are needed before we can bring it up in dual-primary mode. 
- 
 ====bootstrapping DRBD==== ====bootstrapping DRBD====
 Getting DRBD initially up-and-running has always has a bit of voodoo behind it... trying a number of commands and eventually stumbling upon something that works. I may have finally gotten the procedure down: Getting DRBD initially up-and-running has always has a bit of voodoo behind it... trying a number of commands and eventually stumbling upon something that works. I may have finally gotten the procedure down:
Line 626: Line 645:
 sokraits:~# drbdadm -- --overwrite-data-of-peer primary xen_data sokraits:~# drbdadm -- --overwrite-data-of-peer primary xen_data
 </cli> </cli>
 +
 +Of course, this isn't so willy nilly if one of the peers has the more up-to-date copy of the data.
  
 Upon which we can now view /proc/drbd and see messages like: Upon which we can now view /proc/drbd and see messages like:
Line 713: Line 734:
 node: node:
       ip_port = 7777       ip_port = 7777
-      ip_address = 10.80.1.46+      ip_address = 172.16.1.1
       number = 0       number = 0
       name =  sokraits       name =  sokraits
Line 720: Line 741:
 node: node:
       ip_port = 7777       ip_port = 7777
-      ip_address = 10.80.1.47+      ip_address = 172.16.1.2
       number = 1       number = 1
       name =  halfadder       name =  halfadder
Line 729: Line 750:
       name = datastore       name = datastore
 </code> </code>
- +====/etc/drbd.d/global_common.conf AFTER OCFS2 is ready====
-====/etc/drbd.conf AFTER OCFS2 is ready====+
 Once the other prerequisites are taken care of, we can bring the OCFS2 cluster up in dual primary mode, as the following config file allows for. Duplicate this on both peers. Once the other prerequisites are taken care of, we can bring the OCFS2 cluster up in dual primary mode, as the following config file allows for. Duplicate this on both peers.
  
 <code> <code>
-global+global                                                                                    
 { {
     usage-count no;     usage-count no;
 } }
 +                                                                                          
 common common
 { {
Line 746: Line 766:
         degr-wfc-timeout 60;         degr-wfc-timeout 60;
         become-primary-on both;         become-primary-on both;
-    } +    }   
- +
-    net +
-    { +
-        allow-two-primaries; +
-        after-sb-0pri discard-zero-changes; +
-        after-sb-1pri discard-secondary; +
-        after-sb-2pri disconnect; +
-    }+
  
     disk     disk
-    {+    {   
         on-io-error detach;         on-io-error detach;
-    }+    }        
 + 
 +    net 
 +    {    
 +        allow-two-primaries yes; 
 +    }   
  
     syncer     syncer
-    { +    {    
-        rate 40M+        rate 80M
-    }+    }       
  
     protocol C;     protocol C;
 } }
 +</code>
  
-resource xen_data +This **/etc/drbd.d/global_common.conf** file needs to be identical and present on BOTH DRBD peers.
-+
-    on sokraits +
-    { +
-        device      /dev/drbd0; +
-        disk        /dev/md0; +
-        address     172.16.2.1:7789; +
-        meta-disk   internal; +
-    }+
  
-    on halfadder +Recognizing the changes does not require a reboot! The following command (run on both DRBD peers), will update the config:
-    { +
-        device      /dev/drbd0; +
-        disk        /dev/md0; +
-        address     172.16.2.2:7789; +
-        meta-disk   internal; +
-    } +
-+
-</code> +
- +
-This **/etc/drbd.conf** file needs to be identical and present on BOTH DRBD peers.+
  
 +<cli>
 +machine:~# drbdadm adjust xen_data
 +</cli>
 ====Bringing OCFS2 online==== ====Bringing OCFS2 online====
 Assuming **/etc/ocfs2/cluster.conf** and **/etc/default/o2cb** are configured and identical, we can now establish OCFS2 cluster connectivity. Assuming **/etc/ocfs2/cluster.conf** and **/etc/default/o2cb** are configured and identical, we can now establish OCFS2 cluster connectivity.
Line 848: Line 851:
 </code> </code>
  
 +====Turn swapiness way down====
 +The Linux default for swapiness is 60, which will result in the system paging stuff out to swap. Cranking it down to 10 seems a more prudent setting, especially on systems with SSDs, where we want them used as little as possible.
 +
 +I added the following line to **/etc/sysctl.conf** on both systems:
 +
 +<code>
 +vm.swappiness = 10
 +</code>
 +
 +====/tmp in RAM====
 +Seems Debian has a nice built-in support for mounting /tmp in tmpfs (RAM-backed filesystem). All you need to do is edit **/etc/default/tmpfs**, and uncomment/change the following line:
 +
 +<code>
 +RAMTMP=yes
 +</code>
 +
 +And reboot!
 ====integrating the array's storage into the system==== ====integrating the array's storage into the system====
 The disk array is going to hold both Xen virtual machine images (and supporting files), but also serve as another backup destination for resources in the LAIR. The disk array is going to hold both Xen virtual machine images (and supporting files), but also serve as another backup destination for resources in the LAIR.
Line 857: Line 877:
   * /backup - location of backup data (symlink to /export/backup)   * /backup - location of backup data (symlink to /export/backup)
  
-====/etc/rc.local==== 
-Until a proper place can be found, the following manual configurations are performed in **/etc/rc.local**: 
- 
-<code> 
-ethtool -K peth0 tx off 
-</code> 
  
-I didn't want to apply it to /etc/network/interfaces, because I don't know the state of peth0 at that point in the boot process. Since peth0 is created as a result of Xen finanglingsit is more guaranteed that it will exist and be ready to be modified by the point that **/etc/rc.local** is run, so I placed it here. A more suitable place likely exists (I just do not know where it is).+====Historical: Configuring xen-tools to create Debian jessie VMs==== 
 +**This is no longer neededbut may well be in the future.**
  
-====Configuring xen-tools to create Debian jessie VMs==== 
 There are two changes needed to successfully create jessie VMs, and both are symlinks: There are two changes needed to successfully create jessie VMs, and both are symlinks:
  
Line 1094: Line 1108:
  
 Wait at least 5 minutes for data reporting to make it into graphable form. Wait at least 5 minutes for data reporting to make it into graphable form.
 +
 +=====Sync'ing to data store=====
 +Since we've been successful running the systems out of a RAMdisk, care must be taken to preserve any changes in the event of a reboot or power failure.
 +
 +====rsync to disk====
 +
 +In this light, I first had the systems rsync'ing to their local SSD (boot drive). I rigged up a custom cronjob than ran 3 times a day. It looks as follows:
 +
 +<code>
 +12 */8 *         (mkdir -p /tmp/sda1; mount /dev/sda1 /tmp/sda1; rsync -av --one-file-system / /tmp/sda1/; umount /tmp/sda1)
 +</code>
 +
 +====rsync to fileserver====
 +
 +This worked handily until sokraits lost its boot drive (again! In 2 months time!) so I decided to investigate netbooting using an NFSroot.
 +
 +In the process, I may have finally made a breakthrough in my longtime desire to put the entire system IN the initial ramdisk (so it would be running in RAM from the get-go). Turns out, according to the manual page, you merely have to put the system IN the initrd file... obviously one needs adequate memory (2x at boot- enough for the initrd, and enough to decompress it).
 +
 +My cron job changed as follows:
 +
 +<code>
 +24 */8 *         (rsync -av --one-file-system / data.lair.lan:/export/tftpboot/netboot/halfadder/disk/)
 +</code>
 +
 +I plan to rig up either some daily autogeneration of the initrd, or have a script on standby that can use to make it. This will then become the method of booting both sokraits and halfadder (and potentially freeing up a still-working SSD in the process! Which I can use in data2).
 +
 +On the fileserver, I then obtain the latest copy of the hypervisor, kernel, and generate a new all-system initrd:
 +
 +<cli>
 +data1:/export/tftpboot/netboot/halfadder# cp disk/boot/xen-4.4-amd64.gz .
 +data1:/export/tftpboot/netboot/halfadder# cp disk/boot/vmlinuz-3.16-2-amd64 linux
 +data1:/export/tftpboot/netboot/halfadder# cd disk
 +data1:/export/tftpboot/netboot/halfadder/disk# find . | cpio -c -o | gzip -9 > ../initrd.gz
 +data1:/export/tftpboot/netboot/halfadder/disk# 
 +</cli>
 +
 +====pxeboot file for sokraits/halfadder====
 +On the fileserver, in **/export/tftpboot/pxelinux.cfg/** are two files, **0A50012E** (sokraits) and **0A50012F** (halfadder)... they are named according to the machine's IP address (only in hex).
 +
 +The file(s) contain:
 +
 +<code>
 +default netboot
 +prompt 1
 +timeout 2
 +
 +label netboot
 +    kernel mboot.c32
 +    append netboot/halfadder/xen-4.4-amd64.gz --- netboot/halfadder/linux console=tty0 root=/dev/ram0 ro --- netboot/halfadder/initrd.gz
 +
 +label memtest
 +    kernel distros/memtest/memtest86+
 +</code>
  
 =====References===== =====References=====
Line 1128: Line 1195:
 ====DRBD+OCFS2==== ====DRBD+OCFS2====
   * http://www.clusterlabs.org/wiki/Dual_Primary_DRBD_%2B_OCFS2   * http://www.clusterlabs.org/wiki/Dual_Primary_DRBD_%2B_OCFS2
 +
 +====Debian from RAM====
 +  * http://reboot.pro/topic/14547-linux-load-your-root-partition-to-ram-and-boot-it/
 +  * debirf: 
 +    * http://cmrg.fifthhorseman.net/wiki/debirf
 +    * http://www.sphaero.org/blog:2012:0114_running_debian_from_ram
 +
 +====/tmp as noexec====
 +  * http://www.debian-administration.org/articles/57
 +
 +====netboot system to nfsroot====
 +  * http://www.iram.fr/~blanchet/tutorials/read-only_diskless_debian7.pdf
 +    * this led me to the initrd man page which indicated we might be able to stick the entire system in the initrd and PXE boot that. So many things become simpler at that point.
haas/system/sokraits_halfadder.offbyone.lan.1407426562.txt.gz · Last modified: 2014/08/07 15:49 by wedge