Don’t exceed 9 characters on username. Seems like nick is not limited to 9 characters as RFC1459 and RFC2812 say, but usernames longer than 9 do NOT work.
Author Archives: ForDoDone
awk multiple input field separators
We want just the last directory in the tree from this list:
# tail -3 list
/mnt/fs92/vol3/users/520/520/1680520 -- 8631
/mnt/fs92/vol3/users/568/8568/1578568 -- 2
/mnt/fs92/vol3/users/429/7429/1757429 -- 2
You can use both cut and awk, or awk twice…
weak:
# tail -3 list | cut -d / -f 8 | awk '{print $1}'
1680520
1578568
1757429
Or you can just tell awk to use multiple field separators. They are bound by square brackets, and in this case we can use both / and a space to be the input field separators, making the 8th column the one we are interested in.
strong:
# tail -3 list | awk -F "[/ ]" '{print $8}'
1680520
1578568
1757429
increase number of inodes in netapp volume
Your NetApp volume is at 85% and all is well right? What about inode
usage? Don’t forget to monitor that and increase it as needed. Don’t set it too high, because inodes
take up space, and you can’t shrink the number of inodes
. If you do run out of inodes
, you will get an autosupport, but until you provision more inodes
no writes can happen on the volume. Use the maxfiles
command to see how many you have as well as to increase the number.
toaster> maxfiles vol1
Volume vol1: maximum number of files is currently 35999995 (35056570 used).
toaster> maxfiles vol1 37000000
dig spf and domainkeys txt records
# dig txt fordodone.com @4.2.2.2
;; ANSWER SECTION:
fordodone.com. 900 IN TXT "v=spf1 mx -all"
fordodone.com. 900 IN TXT "spf2.0/mfrom mx"
# dig txt mx._domainkey.fordodone.com
;; ANSWER SECTION:
mx._domainkey.fordodone.com. 3472 IN TXT "p=MIGfMA0GCSqGSIb3DQEBAJFHEBCY5DCBiQKBgQC1zZ4Mc7HiXNM0Cu3GZxwcI9vs4nIIcAIlzefnB9MbXrmQJF0m75BsKj8xer23oS7apleInob0RjneHbi+bwvEAa/NN7AjxTxla42dLoXOM+1B0Wf6taG3Vma/FS3bOdqWKo1J4hP8masXJ+PdkMy+LWqSp66fvJtG9U6/eQ4sJwIDAQAB\;"
get actual size of sparse file
You can see the actual size of a sparse file vs. the apparent size.
# ls -l /var/log/lastlog
-rw-rw-r-- 1 root utmp 684182572 Oct 24 16:56 /var/log/lastlog
# du --apparent-size /var/log/lastlog
668148 /var/log/lastlog
# du -h /var/log/lastlog
48K /var/log/lastlog
# ls -ls /var/log/lastlog
48 -rw-rw-r-- 1 root utmp 684182572 Oct 24 16:56 /var/log/lastlog
monitor NetApp RAID reconstruction
# while true; do echo $(ssh fs03 “sysconfig -r” |grep reconstruction | grep RAID | awk ‘{print $5}’) `date`; sleep 5m; done;
31% Wed Oct 23 15:29:42 PDT 2013
convert log time seconds to readable date
[1122633.028643] end_request: I/O error, dev sdc, sector 0
When looking in logs, like dmesg, error messages are preceded by a number that represents the uptime on the server in seconds at the time of the error. So this I/O error happened 1122633 seconds after the machine booted. This means nothing to us. In order to see when the error happened, you need to convert the seconds of uptime into a readable date.
First get the date/time at which the server booted using who -b
and convert to seconds. Then add the seconds of uptime from the error message, and then convert back to a human readable date:
# date --date="@$(echo $(date --date="`who -b | awk '{print $3" "$4}'`" +%s)+1122633|bc)"
# Tue Oct 22 00:03:33 PDT 2013
So this error happened shortly after midnight. Very interesting…
delete entries from conntrack table
To delete many many entries to a destination IP in conntrack table:
# conntrack -D -d 11.22.33.44
ESXi add portgroup to vswitch with esxcli
Using ESXi 5.1, add the portgroup first, then define vlan id for it:
# esxcli network vswitch standard portgroup add -v vSwitch1 -p vlan701
# esxcli network vswitch standard portgroup set -p vlan701 -v 701
Use CLI to make vim default editor
Helpful to run in setup scripts:
# update-alternatives --set editor /usr/bin/vim.basic