This article puts useless and greedy software out of work:
http://www.raymond.cc/blog/installing-windows-7-system-recovery-into-usb-flash-drive/2/
http://www.raymond.cc/blog/installing-windows-7-system-recovery-into-usb-flash-drive/2/
cd /usr/src/
mkdir php
cd php/
wget http://www.php.net/get/php-5.5.5.tar.gz/from/de1.php.net/mirror
tar -xzvf php-5.5.5.tar.gz
cd php-5.5.5/ext/pdo_pgsql
phpize
aclocal
./configure --help
./configure --with-pdo-pgsql=/usr/pgsql-9.3
make
ls modules
ls /usr/lib64/php/modules
rm -f /usr/lib64/php/modules/pdo_pgsql.so
cp modules/pdo_pgsql.so /usr/lib64/php/modules/
service httpd restart
mdadm [mode] [array] [options]
/dev/hde1 /dev/hdf2 /dev/hdg1
%# fdisk -l
Disk /dev/hda: 12.0 GB, 12072517632 bytes 255 heads, 63 sectors/track, 1467 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 144 1052257+ 83 Linux /dev/hda3 145 209 522112+ 82 Linux swap /dev/hda4 210 1467 10104885 5 Extended /dev/hda5 210 655 3582463+ 83 Linux ... ... /dev/hda15 1455 1467 104391 83 Linux
%# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda2 1035692 163916 819164 17% / /dev/hda1 101086 8357 87510 9% /boot /dev/hda15 101086 4127 91740 5% /data1 ... ... ... /dev/hda7 5336664 464228 4601344 10% /var
%# umount /dev/hde1 %# umount /dev/hdf2 %# umount /dev/hdg1
%# fdisk /dev/hde The number of cylinders for this disk is set to 8355. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): Use FDISK Help Now use the fdisk m command to get some help: Command (m for help): m ... ... p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id ... ... Command (m for help): Set The ID Type To FD Partition /dev/hde1 is the first partition on disk /dev/hde. Modify its type using the t command, and specify the partition number and type code. You also should use the L command to get a full listing of ID types in case you forget. Command (m for help): t Partition number (1-5): 1 Hex code (type L to list codes): L ... ... ... 16 Hidden FAT16 61 SpeedStor f2 DOS secondary 17 Hidden HPFS/NTF 63 GNU HURD or Sys fd Linux raid auto 18 AST SmartSleep 64 Novell Netware fe LANstep 1b Hidden Win95 FA 65 Novell Netware ff BBT Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): Make Sure The Change Occurred Use the p command to get the new proposed partition table: Command (m for help): p Disk /dev/hde: 4311 MB, 4311982080 bytes 16 heads, 63 sectors/track, 8355 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hde1 1 4088 2060320+ fd Linux raid autodetect /dev/hde2 4089 5713 819000 83 Linux /dev/hde4 6608 8355 880992 5 Extended /dev/hde5 6608 7500 450040+ 83 Linux /dev/hde6 7501 8355 430888+ 83 Linux Command (m for help): Save The Changes Use the w command to permanently save the changes to disk /dev/hde: Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks.
%# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/hde1 /dev/hdf2 /dev/hdg1 mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 64K mdadm: /dev/hde1 appears to contain an ext2fs file system size=48160K mtime=Sat Jan 27 23:11:39 2007 mdadm: /dev/hdf2 appears to contain an ext2fs file system size=48160K mtime=Sat Jan 27 23:11:39 2007 mdadm: /dev/hdg1 appears to contain an ext2fs file system size=48160K mtime=Sat Jan 27 23:11:39 2007 mdadm: size set to 48064K Continue creating array? y mdadm: array /dev/md0 started.
%# cat /proc/mdstat Personalities : [raid5] read_ahead 1024 sectors md0 : active raid5 hdg1[2] hde1[1] hdf2[0] 4120448 blocks level 5, 32k chunk, algorithm 3 [3/3] [UUU] unused devices: <none>
%# mkfs.ext3 /dev/md0 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 36144 inodes, 144192 blocks 7209 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 18 block groups 8192 blocks per group, 8192 fragments per group 2008 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
%# mkfs.ext3 -b 4096 -E stride=16 stripe-width=32 /dev/md0
%# mkfs.xfs -d su=64k,sw=3 /dev/md0
mdadm --detail --scan --verbose
%# mdadm --detail --scan --verbose ARRAY /dev/md0 level=raid5 num-devices=4 UUID=77b695c4:32e5dd46:63dd7d16:17696e09 devices=/dev/hde1,/dev/hdf2,/dev/hdg1
%# echo "DEVICE partitions" > /etc/mdadm/mdadm.conf %# mdadm --detail --scan --verbose | awk '/ARRAY/ {print}' >> /etc/mdadm/mdadm.conf
%# mkdir /raid
/dev/md0 /raid ext3 defaults 1 2
#/dev/hde1 /data1 ext3 defaults 1 2 #/dev/hdf2 /data2 ext3 defaults 1 2 #/dev/hdg1 /data3 ext3 defaults 1 2
%# mount -a
%# mount /raid
%# mount /dev/md0 /raid
%# raidstart /dev/md0 %# cat /proc/mdstat Personalities : [raid5] read_ahead 1024 sectors md0 : active raid5 hdg1[2] hde1[1] hdf2[0] 4120448 blocks level 5, 32k chunk, algorithm 3 [3/3] [UUU] unused devices: <none>
%$ watch cat /proc/mdstat
echo 'check' >/sys/block/md0/md/sync_action
cat /sys/block/md0/md/mismatch_cnt
ARRAY /dev/md/1 level=raid1 num-devices=2 metadata=1.2 name=linuxWork:1 UUID=147c5847:dabfe069:79d27a05:96ea160b devices=/dev/sda1 ARRAY /dev/md/2 level=raid1 num-devices=2 metadata=1.2 name=linuxWork:2 UUID=68a95a22:de7f7cab:ee2f13a9:19db7dad devices=/dev/sda2
DEVICE partitions HOMEHOST <system> ARRAY /dev/md/1 metadata=1.2 UUID=147c5847:dabfe069:79d27a05:96ea160b name=linuxWork:1 ARRAY /dev/md/2 metadata=1.2 UUID=68a95a22:de7f7cab:ee2f13a9:19db7dad name=linuxWork:2
/dev/sda1: Magic : a92b4efc Version : 1.2 Feature Map : 0x0 Array UUID : 147c5847:dabfe069:79d27a05:96ea160b Name : linuxWork:1 Creation Time : Thu May 23 09:17:01 2013 Raid Level : raid1 Raid Devices : 2
%# mdadm /dev/md0 --fail /dev/hde1 %# mdadm /dev/md0 -f /dev/hde1
%# mdadm /dev/md0 --remove /dev/hde1 %# mdadm /dev/md0 -r /dev/hde1
%# mdadm /dev/md0 --add /dev/hde1 %# mdadm /dev/md0 -a /dev/hde1
%# mdadm --assemble /dev/md0 /dev/hde1 /dev/hdf2 /dev/hdg1 %# mdadm --assemble --scan
%# mdadm /dev/md0 --add /dev/hdh2
%# mdadm --detail /dev/md0 %# cat /proc/mdstat
%# mdadm -G /dev/md0 --raid-devices=4
/proc/sys/dev/raid/speed_limit_min /proc/sys/dev/raid/speed_limit_max
%# cat /proc/mdstat
%# mdadm --detail --scan >> /etc/mdadm/mdadm.conf %# vi /etc/mdadm/mdadm.conf
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active(auto-read-only) raid1 sda1[0] sdb1[1] 78148096 blocks [2/2] [UU] resync=PENDING
echo idle > /sys/block/md0/md/sync_action
active (auto-read-only)
» в файле /proc/mdstat
, то возможно вы просто ничего не записывали в этот массив. К примеру, после монтирования раздела и любых изменений в примонтированном каталоге, статус автоматически меняется:md0 : active raid1 sdc[0] sdd[1]
%# umount /dev/md0 %# mdadm --stop /dev/md0
%# mdadm --assemble /dev/md5 /dev/sd[abcdefghijk]1 --update=name
%# mdadm --assemble /dev/md5 /dev/sd[abcdefghijk]1 --update=super-minor
%# umount /dev/md0 %# mdadm -S /dev/md0
%# mdadm --zero-superblock /dev/hde1 %# mdadm --zero-superblock /dev/hdf2
%# dd if=/dev/zero of=/dev/hde1 bs=512 count=1 %# dd if=/dev/zero of=/dev/hdf2 bs=512 count=1
#!/bin/bash
# Usage:
# hpacucli_mon <NUM OF ARRAYS> <NUM OF PHISYCAL DISKS> <MAIL TO>
HP_SLOT=`/usr/sbin/hpacucli ctrl all show status | grep -o -P 'Slot.{0,2}'| awk -F" " '{print $2}'`
if [ "$3" = "" ] || [ "$4" != "" ];then
echo ""
echo "ERROR: hpacucli_mon requires number of arrays, disks and valid email"
echo ""
echo "Usage: hpacucli_mon <NUM OF ARRAYS> <NUM OF PHISYCAL DISKS> <MAIL TO>"
echo ""
echo "To find amount of arrays and disks you do have run:"
echo "/usr/sbin/hpacucli ctrl slot=$HP_SLOT ld all show status"
echo "and"
echo "/usr/sbin/hpacucli ctrl slot=$HP_SLOT pd all show status"
exit
fi
EMAILMESSAGE="/tmp/hpacucli_message.txt"
LOCAL_IP=`/sbin/ifconfig eth0 | grep -Eo '(([0-9]{1,3}\.){3}[0-9]{1,3})' | grep -v ".255"`
MSG_SUBJECT="Smart HP array failure at $LOCAL_IP"
OK_ARRAY_CNT=`/usr/sbin/hpacucli ctrl slot=$HP_SLOT ld all show status | grep -o "OK" | wc -l`
OK_DISKS_CNT=`/usr/sbin/hpacucli ctrl slot=$HP_SLOT pd all show status | grep -o "OK" | wc -l`
if [ "$OK_ARRAY_CNT" -ne $1 ] || [ "$OK_DISKS_CNT" -ne $2 ]; then
echo "We have encountered a problem at $LOCAL_IP" > $EMAILMESSAGE
echo "Take look at this: ">> $EMAILMESSAGE
/usr/sbin/hpacucli ctrl slot=$HP_SLOT ld all show status >> $EMAILMESSAGE
/usr/sbin/hpacucli ctrl slot=$HP_SLOT pd all show status >> $EMAILMESSAGE
echo "===============================================" >> $EMAILMESSAGE
echo "INFORMATION PROVIDED BY SMARTCTL:" >> $EMAILMESSAGE
echo "" >> $EMAILMESSAGE
for (( i=0; i<$2; i++ ))
do
/usr/sbin/smartctl -a -d cciss,$i /dev/cciss/c0d0 | grep -E '(Serial|Health)' >> $EMAILMESSAGE
echo "" >> $EMAILMESSAGE
done
mail -s "$MSG_SUBJECT" "$3" < $EMAILMESSAGE
fi
create it as /usr/local/sbin/hpacucli_mon00 */1 * * * /usr/local/sbin/hpacucli_mon 2 4 yourname@yourwebsite.com
We have encountered a problem at 192.168.12.13Take look at this:
logicaldrive 1 (136.7 GB, RAID 1): OK
physicaldrive 2I:1:1 (port 2I:box 1:bay 1, 146 GB): OK physicaldrive 2I:1:2 (port 2I:box 1:bay 2, 146 GB): OK
===============================================INFORMATION PROVIDED BY SMARTCTL:
Serial number: 3NM51VPY000098372XJXSMART Health Status: OK
Serial number: 3NM1LPG100009740XJX5SMART Health Status: OK
tcpdump
instead of other tools whenever possible.15:31:34.079416 IP (tos 0x0, ttl 64, id 20244, offset 0, flags [DF], proto: TCP (6), length: 60) source.35970 > dest.80: S, cksum 0x0ac1 (correct), 2647022145:2647022145(0) win 5840 0x0000: 4500 003c 4f14 4000 4006 7417 0afb 0257 E.. 0x0010: 4815 222a 8c82 0050 9dc6 5a41 0000 0000 H."*...P..ZA.... 0x0020: a002 16d0 0ac1 0000 0204 05b4 0402 080a ................ 0x0030: 14b4 1555 0000 0000 0103 0302
tcpdump
command itself, depending on what I'm looking at. The first of these is -n, which requests that names are not resolved, resulting in the IPs themselves always being displayed. The second is -X, which displays both hex and ascii content within the packet. The final one is -S, which changes the display of sequence numbers to absolute rather than relative. The idea there is that you can't see weirdness in the sequence numbers if they're being hidden from you. Remember, the advantage of usingtcpdump
vs. another tool is getting manual interaction with the packets.tcpdump
only takes the first -i any
: Listen on all interfaces just to see if you're seeing any traffic.-n
: Don't resolve hostnames.-nn
: Don't resolve hostnames or port names.-X
: Show the packet's contents in both hex and ASCII.-XX
: Same as -X
, but also shows the ethernet header.-v, -vv, -vvv
: Increase the amount of packet information you get back.-c
: Only get x number of packets and then stop.-s
: Define the snaplength (size) of the capture in bytes. Use -s0
to get everything, unless you are intentionally capturing less.-S
: Print absolute sequence numbers.-e
: Get the ethernet header as well.-q
: Show less protocol information.-E
: Decrypt IPSEC traffic by providing an encryption key.tcpdump
4.0 has changed from 68 bytes to 96 bytes. While this will give you more of a packet to see, it still won't get everything. Use-s 1514
to get full coverage ]tcpdump
, as can be seen below:-c2
) ICMP packets (a ping and pong) using some of the options described above. Notice how much we see about each packet.hermes root # tcpdump -nnvXSs 0 -c2 icmp tcpdump: listening on eth0, link-type EN10MB (Ethernet), 23:11:10.370321 IP (tos 0x20, ttl 48, id 34859, offset 0, flags [none], length: 84) 69.254.213.43 > 72.21.34.42: icmp 64: echo request seq 0 0x0000: 4520 0054 882b 0000 3001 7cf5 45fe d52b E..T.+..0.|.E..+ 0x0010: 4815 222a 0800 3530 272a 0000 25ff d744 H."*..50'*..%..D 0x0020: ae5e 0500 0809 0a0b 0c0d 0e0f 1011 1213 .^.............. 0x0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223 .............!"# 0x0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233 $%&'()*+,-./0123 0x0050: 3435 3637 4567 23:11:10.370344 IP (tos 0x20, ttl 64, id 35612, offset 0, flags [none], length: 84) 72.21.34.42 > 69.254.213.43: icmp 64: echo reply seq 0 0x0000: 4520 0054 8b1c 0000 4001 6a04 4815 222a E..T....@.j.H."* 0x0010: 45fe d52b 0000 3d30 272a 0000 25ff d744 E..+..=0'*..%..D 0x0020: ae5e 0500 0809 0a0b 0c0d 0e0f 1011 1213 .^.............. 0x0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223 .............!"# 0x0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233 $%&'()*+,-./0123 0x0050: 3435 3637 4567 2 packets captured 2 packets received by filter 0 packets dropped by kernel hermes root #
tcpdump
. There are three main types of expression: type
, dir
, andproto
.host
, net
, and port
. Direction is indicated by dir
, and there you can have src
, dst
, src or dst
, and src and dst
. Here are a few that you should definitely be comfortable with:host
// look for traffic based on IP address (also works with hostname if you're not using -n)src
, dst
// find traffic from only a source or destination (eliminates one side of a host conversation)net
// capture an entire network using CIDR notationproto
// works for tcp, udp, and icmp. Note that you don't have to type proto
port
// see only traffic to or from a certain portsrc, dst port
// filter based on the source or destination portsrc/dst, port, protocol
// combine all threetcpdump portrange 21-23
tcpdump less 32
tcpdump greater 128
tcpdump > 32
tcpdump <= 128
tcpdump
allows you to send what you're capturing to a file for later use using the -w
option, and then to read it back using the -r
option. This is an excellent way to capture raw traffic and then run it through various tools later.tcpdump
format, which is pretty much universal in the network analysis space. This means it can be read in by all sorts of tools, including Wireshark, Snort, etc.tcpdump
tcpdump
comes from the ability to combine them in creative ways in order to isolate exactly what you're looking for. There are three ways to do combinations, and if you've studied computers at all they'll be pretty familar to you:and
or &&
or
or ||
not
or !
tcpdump
to ignore certain special characters -- in this case the "( )" brackets. This same technique can be used to group using other expressions such as host
, port
, net
, etc. Take a look at the command below:tcpdump
's flag field output. URGs and ACKs are displayed, but they are shown elsewhere in the output rather than in the flags field ]tcp[13]
looks at offset 13 in the TCP header, the number represents the location within the byte, and the !=0 means that the flag in question is set to 1, i.e. it's on.tcpflags
Option...vim
Primertcpdump
Primerlsof
Primer