วันพฤหัสบดีที่ 16 มิถุนายน พ.ศ. 2554

How to Setup Canon MX350 Series on Ubuntu 11.04 Natty

sudo add-apt-repository ppa:michael-gruz/canon
sudo apt-get update

apt-get install cnijfilter-mx350series

and now you can add printer by
1. Go to search -> printing
2. Add -> Network Printer
3. Canon MX350 Series will appear in left panel
4. Follow the instruction
5. Finish installation

วันพฤหัสบดีที่ 9 มิถุนายน พ.ศ. 2554

Ubuntu apt-get history

for Ubuntu admin you can track apt-get history at

/var/log/apt/history.log
for a brief

and

for more detail at
/var/log/apt/term.log

mdadm cheat sheet

Mdadm Cheat Sheet

1. Create a new RAID array

Create (mdadm –create) is used to create a new array:
mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2
or using the compact notation:
mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1

2. /etc/mdadm.conf

/etc/mdadm.conf or /etc/mdadm/mdadm.conf (on debian) is the main configuration file for mdadm. After we create our RAID arrays we add them to this file using:
mdadm --detail --scan >> /etc/mdadm.conf
or on debian
mdadm --detail --scan >> /etc/mdadm/mdadm.conf

3. Remove a disk from an array

We can’t remove a disk directly from the array, unless it is failed, so we first have to fail it (if the drive it is failed this is normally already in failed state and this step is not needed):
mdadm --fail /dev/md0 /dev/sda1
and now we can remove it:
mdadm --remove /dev/md0 /dev/sda1

This can be done in a single step using:
mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1

4. Add a disk to an existing array

We can add a new disk to an array (replacing a failed one probably):
mdadm --add /dev/md0 /dev/sdb1


5. Verifying the status of the RAID arrays

We can check the status of the arrays on the system with:
cat /proc/mdstat
or
mdadm --detail /dev/md0

The output of this command will look like:

cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

md1 : active raid1 sdb3[1] sda3[0]
19542976 blocks [2/2] [UU]

md2 : active raid1 sdb4[1] sda4[0]
223504192 blocks [2/2] [UU]

here we can see both drives are used and working fine – U. A failed drive will show as F, while a degraded array will miss the second disk -

Note: while monitoring the status of a RAID rebuild operation using watch can be useful:
watch cat /proc/mdstat

6. Stop and delete a RAID array

If we want to completely remove a raid array we have to stop if first and then remove it:
mdadm --stop /dev/md0
mdadm --remove /dev/md0

and finally we can even delete the superblock from the individual drives:
mdadm --zero-superblock /dev/sda

#Clone partition table
sfdisk -d /dev/sda | sfdisk /dev/sdb

(this will dump the partition table of sda, removing completely the existing partitions on sdb, so be sure you want this before running this command, as it will not warn you at all).

There are many other usages of mdadm particular for each type of RAID level, and I would recommend to use the manual page (man mdadm) or the help (mdadm –help) if you need more details on its usage. Hopefully these quick examples will put you on the fast track with how mdadm works.

Reference :
http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/

วันศุกร์ที่ 3 มิถุนายน พ.ศ. 2554

ubuntu snmp

I've install cacti to a server which will poll the data from linux box, installed snmp.

To test polling data from cacti to linux box,
#snmpwalk -c public -v 2c [ip-address]

In ubuntu if you want to allow other host to view this data you need to modified
"/etc/default/snmp "

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid [ip-address]'