• ComputerKing HTPC

    ComputerKing HTPC

  • Acer Veriton

    Acer Veriton

  • Solar Systems

    Solar Systems

Category Archives: Technical

Backup Restore or Clone LIVE

Backup/Restore/Clone a partition LIVE using LVM Snapshots and rsync

Formulated this hack to fix the disk errors on my /var partition normally you could do this with any partition and could be preformed live too. However considering i have to do fsck on /var the machine must be shutdown -h now first then you have to restart udev using /etc/init.d/udev start to get snapshots working again.  Note some sort of remote console is need for this operation iDrac for instance.

Backup

Do a backup of /var to /usr/backups/rsync_var using a handy dandy snapshot

mkdir /usr/local/backups/snap_var
mkdir /usr/local/backups/rsync_var
lvcreate -L15G -s -n snap_var /dev/vg1/var
mount /dev/vg1/snap_var /usr/backups/snap_var

This command should be edited to taste note –inplace or –sparse options here however i do not think these matters as i have tried not to create any KVM images on /var instead making them have their own LVM partition, problem solved right? you tell me if you know!

time ionice -c2 -n7 rsync --archive --one-file-system --hard-links --acls --xattrs --human-readable --inplace --numeric-ids --delete --delete-excluded --progress --log-file=/root/rsync.log --exclude-from=/root/rsync-exclude-var.txt --include-from=/root/rsync-include-var.txt /usr/backups/snap_var/ /usr/backups/rsync_var
lvremove /dev/vg1/snap_var

revision 2 of thist command


time rsync ionice -c2 -n7 -a -A -x -X -v -h --progress --delete --delete-excluded --exclude='/var/lib/vz/dump' --exclude='/var/lib/vz/private/101' --log-file=/root/rsync.log /usr/local/backups/snap_var/ /var3

Note the above beautify crafted rsync command requires the existence of /root/rsync-exclude.txt and /root/rsync-include.txt and creates a log file called /root/rsync.log. I will put some examples here soon for excluding complicated exclude commands

Implement as a quick and dirty rescue backup

Hoping i do not have to use this, but for example if the fsck breaks my /var partition i can slip in the fresh backup quite easily using /usr/backups/rsync_var as a new /var partition.

umount /dev/vg1/var
mount /usr/backups/rsync_var /var

Clone and or make perment

Again hoping not to use this for /var but it would come in handy for a standard live partion clone operation
mkdir var2
lvcreate -l 500G -n /dev/vg1/var2
mkfs.ext4 /dev/vg1/var2
mount /dev/mapper/vg1-var2 /var2
time rsync -av --delete --progress /usr/backups/rsync_var/ /var2
umount /dev/vg1/var2
edit /etc/fstab comment out original var line and add this one
/dev/vg1/var2 /var ext4 defaults 0 2
mount -a
rm -r /var2

NOTE you can skip strait to this step by rsyncing directly from the snapshot to the LVM device this is done in the above revised command

migrate software raid 1 to 5

There was a thread about this on the Linux-raid list a little while ago. The process is actually much easier. All you have to do is start the 2-drive RAID1 array as a 2-drive RAID5 array:
mdadm –grow /dev/mdx –level=5
and then add a third hard drive. It is important that the raid set is started as a RAID5 array before the third drive is added.

Setting up your android phone with PAID mail

NEEDS EDITING Introduction Android-based smartphones sync email, contacts, and calendars to Computer King Email accounts. The pre-requisites for configuring your mobile device include: The Computer King email system used by your organization or service provider is a paid Network Edition license (ask your administrator if you are not sure) Your administrator has enabled mobility on your…Continue Reading

Handy hacks

Reinstall video card drivers after botched ubuntu kernel upgrade This one is for my brother as each time he does a kernel upgrade ubuntu forgets to upgrade his video card it has caused both of us alot of grief, nice thing is he can boot to an older kernel version and everything is fine. sudo…Continue Reading

Raid1 on existing system

WORK IN PROGRESS Introduction Backup first and as you will see below i have a Western Digital Green 2T (SLOW) disk called /dev/sdc with partiton /dev/sdc1 mounted at /mnt/2T. This is probaly the last i will mention of this so take heed my warning and backup first! In this tutorial I’m using a Debian Squeeze…Continue Reading

Zimbra KVM

I have a love hate relationship with Zimbra, mostly love to hate it, have a Network Edition KVM which i am not that thrilled with, for alot of reasons comment me if you are interested in them   For this document I have setup a KVM using the OSS version, and wow Zimbra 8 is shiny and…Continue Reading

Recreating or Migrating Space and Saturn

Space and Saturn are special cases because they are KVM and need a separate virtual hard disk drives that we do not want to backup for some partitions. Therefore you must create the new harddisk before starting the machine using the GUI, create a new hard drive. Type:       Virtio Storage:   local-lvm Size:  …Continue Reading

Changing networking Setup in Solar System

Introduction This usually takes a day should only take an hour, but always miss something and have to troubleshoot for at least 5 hours. Made these instructions just in case, god forbid when have to do it again i might not screw it up. Using the setting below they are pretty obscure and leaves room…Continue Reading

Apache rewrite

Here is how to make a redirct work, first add this A record to your database file on the DNS server that manages the the ServerAlias below. Don’t forget to update the serial # if you are old school and still manually edit your database files like me. cool.computerking.ca IN A XXX.XXX.XXX.XXX Next add the…Continue Reading

replica hublot watches rolex replica watches