Você está na página 1de 56

Sysinfo Memory and Swap Disks, Filesystems and Devices Networking

Display system information i.e cpu, memory, etc Information regarding the physical memory and swap area Displaying disk information, filesystems Display and configuring network parameters Configure, display and use the crash dump utiltities Displaying, modifying and tuning kernel parameters Display, start and stop services Installing and removing patches and software packages Setting up and removing user accounts Information on NFS i.e starting, stopping, etc Network Time Protocol Location to common log files Security information Other stuff i.e shutdown, timezone, run level, etc

Crash Dump Performance Monitoring and Diagnostics List, Monitor and trace processes Kernel Modules and Parameters Services Patching / Packages Accounts NFS NTP Log Files Security Misc
Sysinfo Command Description Solaris

Red Hat

Server Release info Server type

cat /etc/release

cat /etc/enterprise-release

/usr/platform/`uname i`/sbin/prtdiag -v

dmidecode

Note: hal = hardware abstraction layer

Hardware Info

Hardware Info Operating System

Memory prtconf | grep -i mem free -om

CPU (type, number, etc) ## display,offline,online

Disk Drives

parted <device> print

Kernel File and associated directories /kernel/genunix

/boot/initrd.?????.img

isainfo -kv (solaris 9+)

uname -a

Kernel 32 or 64

Display Firmware

Display IRQ, IO ports and DMA GUI admin tool Memory and Swap Command Description Solaris /usr/platform/`uname i`/sbin/prtdiag -v prtconf | grep -i mem Red Hat cat /proc/meminfo (detailed) free -om admintool linuxconf

Memory /usr/bin/pagesize page size (memory) swap -l swap -s cat /proc/swaps (detailed) swapon -s /usr/bin/getconf -a| egrep -i 'pagesize|page_size'

display swap mkfile 5m /var/swapfile device:

swap -a /var/swapfile

create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000 mkswap <device>|<file>

update /etc/vfstab

swapon <device>|<file>

update /etc/fstab

adding swap update /etc/vfstab swap -d Remove device or file as normal swapoff <device>|<file>

removing swap Disks, Filesystems and Devices Command Description Solaris format prtvtoc <device> Red Hat fdisk -l sfdisk -l (advanced server) parted <device> print

format -e (to convert EFI (zfs) to SMI) Note: EFI - Extensible Firmware Interface Disk Drives SMI - Sun Microsystems Inc format

partprobe <device>

hdparm -i /dev/hda

iostat -En

hdparm -I /dev/hda (detailed)

luxadm inq <disk> (A5x00 disk arrays) hdparm -Tt /dev/hda (speed test)

sdparm -i /dev/sdb

cat /proc/ide/ide0/hda/model cat /proc/scsi/scsi

Disk serial Number, type, etc prtvtoc <device> fdisk -l sfdisk -l (advanced server) cat /etc/vfstab cat /proc/partitions (very high level) cat /etc/fstab

Disk disk partitions

Disk disk partitions use format to partition the disk then just use the slice as a raw partition, remember to use the character device ## Old way

/etc/sysconfig/rawdevices service rawdevices start chkconfig rawdevices on

## New way, Edit below file /etc/udev/rules.d/60-raw.rules udevinfo -d or udevadm ## Display raw partitions raw -qa df -k df -h

List Raw Partitions df -k df -h Filesystem commands newfs -v <raw device>

mkfs -t ext3 /dev/sdb1

# Display how the filesystem was created newfs -Nv <filesystem>

Filesystem (create|remove)

Filesystem (create|remove) tunefs fstyp -v <device> |grep -i minfree tune2fs tune2fs -l /dev/sda1

# change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1

Tune Filesystems touch /forcefsck shutdown -Fr now

# Check to see filesystem needs checking fstyp -v <filesystem> | grep fsclean

tune2fs -l /dev/sdb<?> |grep i 'filesystem state'

Force fsck ufsdump|ufsrestore tar dd cpio backup filesystem eeprom |grep boot-device prtconf -pv |grep bootpath cat /boot/grub/grub.conf cat /etc/lilo.conf dump/restore tar dd cpio

prtpicl -v|grep ':bootpath' grub = grand unified boot loader lilo = linux loader /boot/grub/grub.conf /etc/lilo.conf

Display the boot device setenv boot-device [<device>|<alias>] eeprom boot-device [<device>|<alias>]

Setting the boot device

Setting the boot device installboot /usr/platform/`uname i`/lib/fs/ufs/bootblk <raw-device> grub-install <raw-device> lilo -v

Creating boot device (MBR) fdformat -v -U volcheck -v newfs -v /vol/disk/aliases/floppy0 Format floppy drive volrmmount -l floppy0 mount/unmount floppy eject floppy mount -F hsfs -o ro <device path> /cdrom/cdrom0 umount /cdrom/cdrom0 floppy --probe (use device obtained below ) floppy --createrc > /etc/fd0 floppy --format /dev/fd0 mkfs /dev/fd0 mount /dev/fd0 /mnt/floppy umount /mnt/floppy mount -rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom eject cdrom

mount/unmount CDROM

/etc/init.d/volmgr start eject cdrom n/a

mount -o remount,rw /

remount a filesystem n/a mkbootdisk `uname -r` (boot diskette)

create boot disk or recovery tape ok> boot cdrom -s using the grub window append the word singleto the kernel line

ok> boot cdrom -s

using the grub window append the word singleto the kernel line

boot cdrom/diskette (single user) ok> boot -as f10 or f12

boot into maintenace mode floppy: disk: /dev/dsk/c0t0d0s0 tape: /dev/rmt/0ucb cdrom: /dev/dsk/c0t6d0s0 floppy: /dev/fd0 disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom:

Device paths

/dev/scd0 (external usb cd) Device paths drvconfig devlinks disks|tapes|ports

/dev/hda (depends on number of IDE disks) /dev/MAKEDEV <device>

update /dev directory

devfsadm ( solaris 8, 9, 10) rem_drv

remove or change a device prtconf -D sysdef cat /proc/devices

list device drivers Networking Solaris /etc/hostname.hme0 Red Hat /etc/sysconfig/network /etc/sysconfig/networkscripts/ifcfg-eth0 ifconfig system-config-network (GUI)

Basic network information (hostname, ip address)

prtdiag -v ifconfig -a

kstat hme:0 kstat e1000g:0

displaying network interfaces

displaying network interfaces ifconfig ifconfig

Configure network interface ifconfig qfe0 up ifconfig qfe0 down /sbin/ifup eth0 /sbin/ifdown eth0

Starting and stopping a network interface ndd -set <device> <parm> <value> (dynamically) /etc/system (edit and update then reboot - permanent) mii-tool -F 100baseTx-FD eth0 ethtool -s eth1 speed 100 duplex full

Setting NIC speed

Setting NIC speed ndd -get <device> <parm> mii-tool -v ethtool eth1 ethtool -t eth0 online

# List parameters ndd -get /dev/hme \? ndd -get /dev/e1000g0 \? ndd -get /dev/ip \? ndd -get /dev/tcp \?

sysctl -a | grep net*

Change NIC parameters

Display NIC statistics ifconfig -a (as user root) display MAC address snoop -d <interface> tcpdump -i <interface> ifconfig system-config-network (GUI)

ethereal (needs to be installed)

Displaying network packets /etc/defaultrouter edit /etc/sysconfig/network

route add default <gteway> default router netstat -rn

add: GATEWAY=<IP address> netstat -rn route -n

display routing table if_mpadm -d (detach) ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach) cat /proc/net/bonding/bond0 /etc/sysconfig/network

if_mpadm -r

(reattach)

tail /var/adm/messages Test IPMP, Bonding change the following files:

/etc/hosts

/etc/nodename /etc/hostname.<interface> /etc/inet/hosts /etc/inet/ipnodes /etc/net - few files in here as well change the hostname setup DNS /etc/resolv.conf /etc/nsswitch.conf /etc/resolv.conf /etc/resolv.conf /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf sysctl -a |grep hostname

Name service switch file (DNS client) Flush DNS cache svcadm restart system/nameservice-cache:default /etc/defaultdomain ## if installed service nscd restart /etc/sysconfig/network (HOSTNAME option) /etc/resolv.conf Note: for NIS use the NISDOMAIN option ip route get <IP address> traceroute Boot (jumpstart) servers: rpcinfo -b bootparam 1

Domain Name Obtain IP Address routing route -n get <hostname> traceroute Boot (jumpstart) servers: rpcinfo -b bootparam 1

NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1 Find Services on the network Crash Dump Solaris dumpadm -d <device>

NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -u <yp server> ypserv

Red Hat diskdump netdump

crash (used to analyse crash kdump (part of kexec rpm) dumps) adb (used to analyse crash dumps) /etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on

## to crash the system echo "c" > /proc/sysrq-trigger

crash (used to analyse crash dumps) Crash Dump

Performance Monitoring and Diagnostics Solaris top (sunfreeware) prstat sar mpstat w (load average) uptime (load average) ps vmstat Red Hat top sar mpstat w (load average)

uptime (load average) ps vmstat procinfo oprofile cat /proc/cpuinfo free vmstat top procinfo slabtop sar cat /proc/meminfo ethtool mii-tool

CPU prstat vmstat top sar

Memory ndd netstat

lsof snoop route Network I/O sar -d iostat vmstat lsof

netstat lsof tcpdump ip iptraf sar -d iostat vmstat lsof

Disk I/O truss -p <pid> strace -p <pid>

Application NFS Kernel Modules and Parameters

nfsstat

nfsstat

Solaris modinfo

Red Hat cat /proc/modules (more detailed) lsmod Location: /lib/modules/`uname r`/kernel/drivers Config: /etc/modprobe.conf /etc/modprobe.d

display loaded modules modload -p drv/<module name> load modules modunload -i <module number> modprobe <module> insmod modprobe -r <module>

unload modules

modunload -i <module number> rmmod unload modules /etc/system (edit and reboot) /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename>

sysctl -w param=value

No reboot (dynamically):

echo "250 32000 100 28" > /proc/sys/kernel/sem echo "536870912" > /proc/sys/kernel/shmmax echo "4096" > /proc/sys/kernel/shmmni echo "2097152" > /proc/sys/kernel/shmall etc................................... ..........

set kernel parameters (tuning) cat /etc/system sysdef -i sysctl -a cat /etc/sysctl.conf

cat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax

display kernel parameters edit and update file then reboot:

etc................................... cd /usr/src/linux-2.5

/etc/system

edit Makefile (change EXTRAVERSION) make mrproper

backup .config make xconfig make dep make bzImage

make modules

build kernel interprocess communication Services

ipcs -a

move new kernel make modules_install change lilo/grub config file reboot ipcs -a

Solaris 10 svcs -a

Red Hat service --status-all

inetadm -l

display services svcadm enable nfs start services svcadm disable nfs stop services reload service restart service service status service dependencies svcadm refresh nfs svcadm restart nfs svcs nfs svcs -d network service nfs stop service nfs reload service nfs restart service nfs staus n/a service nfs start

service dependants

svcs -D network /var/svc/log /var/svc/manifest /lib/svc/method n/a n/a

n/a n/a

service logging, etc change service startup

chkconfig --levels 2345 nfs on # Create your stop/start # script in /etc/init.d chkconfig --add <script>

Add a new service Patching / Software Solaris showrev -p patchadd -p display installed patches

Red Hat

patchadd patch -p1 <patch> patchadd -M <dir> (multiple patches) zcat patch46.gz | patch -p1

Note: -p = # of path stripping adding patch removing patch

patchrm pkginfo (all packages) pkginfo -l (single package) pkgchk -l -p <file> (file belongs)

patch -R -p1 <patch> rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed)

display installed packages

display installed packages pkgadd rpm -Uhv (updates/installs if not already) rpm -ihv (install)

adding package pkgrm rpm -e <package>

removing packages pkginfo -l pkginfo -p verify package pkgchk -l <package> | grep -i pathname List files in package /var/sadm Package directory List libraries required for binary program Accounts Solaris cat /etc/passwd display users create a user remove a user logins -x useradd useradd userdel system-config-users (GUI) userdel system-config-users (GUI) usermod system-config-users (GUI) Red Hat cat /etc/passwd system-config-users (GUI) /var/lib/rpm rpm -ql <package> rpm -V <package>

ldd <file>

ldd <file>

modify a user

usermod

modify a user

usermod

change user password create a group remove a group

passwd groupadd groupdel

passwd groupadd groupdel

modify a goup

groupmod /etc/passwd

groupmod /etc/passwd /etc/shadow id -a whoami who w finger

password files

/etc/shadow id -a whoami who w finger

useful user commands groups setpgrp useful group commands NFS Solaris server: mountd, nfsd client: statd, lockd NFS Daemons /etc/dfs/dfstab /etc/dfs/sharetab /etc/rmtab /etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab Red Hat server: rpc.mountd,nfsd client: rpc.statd, lockd newgrp groups

NFS files

List nfs clients that have a remote mount display nfs shares

/etc/rmtab

/var/lib/nfs/rmtab

dfshares showmount -e localhost showmount -e localhost /etc/dfs/dfstab (edit and add share) redhat-config-nfs (GUI) share <path> /etc/exports (edit and add share) ## dfstab example share -F nfs -d "jumpstart" /export/jumpstart /sbin/service nfs reload ## /etc/exports example /export *(rw,fsid=0,insecure,no_root_s quash,sync)

create nfs share unshare <path> /etc/exports (edit and remove share) /sbin/service nfs reload

/etc/dfs/dfstab (edit and remove share)

uncreate nfs share /etc/init.d/nfs.server start /etc/init.d/nfs.client start /sbin/service nfs start

start/change nfs daemons

svcadm enable nfs/server svcadm disable nfs/server /etc/init.d/nfs.server stop /etc/init.d/nfs.client stop

/sbin/service nfs stop

stop nfs daemons ps -ef|grep < nfs daemons> nfs status nfs reload shareall /sbin/service nfs reload /sbin/service nfs status

nfs performanace

nfsstat n/a

nfsstat cat /var/lib/nfs/etab

nfs Options solaris/redhat mount problems (nfs v3 to v4) NTP Solaris Time daemons xntpd # Solaris 8 ntpd /etc/ntp.conf (edit with ntp servers) dateconfig (GUI) chkconfig --list ntpd chkconfig --level 2345 ntpd on /sbin/service ntpd start Red Hat ## Make sure you use NFS version 3 mount -F nfs -o vers=3 <mount> <mountpoint> n/a

/etc/ntp.conf /etc/ntp.server /etc/ntp.client

/etc/rc2.d/xntpd [start|stop] # Solaris 10 /etc/inet/ntp.server /etc/inet/ntp.client ntp setup svcadm enable ntpd /lib/svc/method/xntp

/etc/sysconfig/ntpd

ntp daemon options ntpq -p ntptrace NTP Trace commands Log Files Solaris messages syslog mail cron /var/cron/log /var/adm/messages /var/log/syslog Red Hat /var/log/messages /var/log/syslog /var/log/mail /var/log/cron ntpq -p ntptrace

/var/adm/messages dmesg

/var/log/boot dmesg

boot

Error logging Security

logger

logger

Solaris Checking the passwd file checking the group file pwck grpck # No reboot required /etc/default/login pwck grpck

Red Hat

# No reboot required /etc/securetty

console login (allow/deny) Misc

Solaris eeprom grub (GUI)

Red Hat

lilo (text based) setenv boot-device startup shutdown -i5 -g0 -y (power down) shutdown -i6 -g0 -y (reboot) shutdown -i0 -g0 -y (OK prompt) shutdown -h (halt) shutdown -r (reboot) shutdown -f (fast reboot no fsck) shutdown -F (force fsck) reboot -- -r (reboot/reconfigure) touch /reconfigure shutdown halt init poweroff reboot shutdown telinit uadmin 0 0 - shutdown 1 1 - single user 2 2 - n/a 3 3 - Multi-user halt init poweroff reboot shutdown telinit

Change run level init status

0 - halt 1 - single user 2 - multiuser (no networking) 3 - multiuser (networking)

4 4 - n/a

4 - unused

5 5 - power off 6 6 - reboot

5 - GUI 6 - reboot

# change default

# change default

vi /etc/inittab -s single user -a interactive -x no device drivers (used in clustering) -r reconfigure devices -m milestone

vi /etc/inittab single - use grub to edit kernel line emergency - use grub to edit kernel line linux rescue - use at the boot prompt single: runlevel1, local fs mounted, no network emergency: root fs read-only, no init files run rescue: use cd-rom/network, root mounted as /mnt/sysimage

Startup options /etc/init.d /etc/init.d

/etc/rc0.d - /etc/rc6.d

/etc/rc0.d - /etc/rc6.d

startup scripts boot printenv setenv banner devalias show-devs F10 or F12

show-pci-devs-all

boot prompt commands

probe-scsi-all probe-fcal-all probe-pci watch-net-all reset-all Phases: Boot PROM: displays system information, run POST, load bootblk, locate ufsboot

Boot sequence 1. BIOS

Boot Programs: bootblk loads and executes the ufsboot

2. POST

Kernel Initialization: ufsboot loads and executes the core kernel, initializes core kernel data structures, loads other kernel modules based on the/etc/system file, starts/sbin/init program init: starts other processes based on the /etc/inittab file

3. Master Boot Record (MBR) point to the bootloader GRUB or LILO

4. GRUB (stage 1) - point to GRUB stage 1_5

5. GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files 6. GRUB (stage 2) reads /etc/grub.conf and displays the grub menu, it specifies the kernel and the initrd files

7. KERNEL - control given to the kernel 8. INIT - reads /etc/inittab and runs /etc/rc.d/rc.sysinit script Boot process who -r determine the run level obtain default run level list locale start xwindows sys-unconfig cat /etc/inittab locale -a n/a runlevel who -r cat /etc/inittab locale -a startx (shorthand of below) initx (lots of parms)

initialize system Timezone /etc/TIMEZONE /etc/default/init /etc/sysconfig/clock /usr/share/zoneinfo/zone.tab

Ubuntu/Debian

HP-UX

AIX

cat /etc/lsb-release

/stand/kernrel

dmidecode

model

prtconf | grep -i 'System Model'

cat /var/opt/ignite/local/m anifest/manifest.info lsdev

free -om

/usr/sam/lbin/getmem prtconf |grep -i memory

parted <device> print

lsdev -Cc disk -S [a|d|s] (available, defined, stopped)

/boot/initrd.img-?????-server

/stand/vmunix

/unix

uname -a

getconf KERNEL_BITS ( version 11)

prtconf -k

getconf HW_CPU_SUPP_BIT S

enter PDC

invscout

enter PDC linuxconf sam

invscout smit

Ubuntu/Debian cat /proc/meminfo (detailed) free -om

HP-UX AIX dmesg | grep -i prtconf -m physical /usr/sam/lbin/getmem prtconf |grep -i memory /opt/ignite/bin/print_ manifest cat /var/opt/ignite/local/m anifest/manifest.info lsattr -El sys0 -a realmem bootinfo -r

/usr/bin/getconf -a| egrep -i 'pagesize|page_size' cat /proc/swaps (detailed) swapon -s

dmesg |grep -i physical

device:

swapinfo (displayed in KB) swapinfo -m (display lsps -s in Mb) swapinfo -tm (total / Mb) Create logical mkps -a -s 4 -n <volume volume or filesystem group>

pagesize pagesize -a (display all supported pagesizes) lsps -a (detailed)

create partition with fdisk (type 82) file(create 50MB swap file): dd if=/dev/zero of=/var/swapfile bs=1024 count=50000 swapon <device> | -f # change the attributes <logical device> swapon -p 3 chps -a n paging00 (don't <device> | -f <logical use after restart) device> update /etc/fstab # change the logical volume attributes (name in this case) chlv -n <new name> <old old> (chang page space name)

mkswap <device>|<file>

swapon <device>|<file>

Note: -p = priority swap number . The nswapdev tunabl e system parameter controls the maximum number of swap devices. update /etc/fstab Note: -a reconfigure paging space after restart -s size of the page space (logical partitions) -n activiates the paging space (use swapoff to deactivate) also see /etc/swapspaces file swapoff /dev/paging00 rmps paging00

swapoff <device>|<file>

remove entry from /etc/fstab reboot

Remove device or file as normal Note: paging space must be deactiviated before removing

Ubuntu/Debian fdisk -l sfdisk -l (advanced server) parted <device> print

HP-UX ioscan -funC disk

AIX lsdev -Cc disk lsdev -Cc disk -p scsi0 (specific controller) lsdev -Cc disk -S [a|d|s] (available, defined,stopped)

partprobe <device> lscfg -v -l hdisk0

hdparm -i /dev/hda

hdparm -I /dev/hda (detailed)

diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number) /opt/ignite/bin/print_ manifest (no serial number)

lscfg -vl hdisk0

lscfg -vl hdisk*

haparm -Tt /dev/hda (speed test)

## Insure that the online diagnostic support tools have been installed swlist -l bundle | grep 'Support Tools'

sdparm -i /dev/sdb ## Command-Line Support Tools Manager (cstm) ## The run cstm cstm cstm> map cstm> sel dev 4 (select the disk of you choice) cstm> info cstm> il (obtain the serial number) cstm> quit lvlnboot -v /dev/vg00 lsvg -l rootvg lifls -Clv <device> lchangelv

cat /proc/ide/ide0/hda/model cat /proc/scsi/scsi

fdisk -l sfdisk -l (advanced server) cat /proc/partitions (very high level) cat /etc/fstab

# Display the LIF cat /etc/filesystems contents lifcp /dev/dsk/c0t6d0:AUT Ocat /etc/fstab Note: Boot programs are stored in the boot area in Logical Interchange Format (LIF), which is similar to a file system. For a device to be bootable, the LIF volume on that device must contain at least the ISL

(the initial system loader) and HPUX (the HP-UX bootstrap utility) LIF files. ISL is like GRUB. mknod /dev/rawctl c 162 0 Just create a new LVOL without a filesystem - that's it. Just create a new LVOL without a filesystem

mknod /dev/raw/raw0 c 162 1 mknod /dev/raw/raw1 c 162 2 ln -s /dev/rawctl /dev/raw/rawctl

# create a raw volume mklv -y rawVolume vg01 10

## map raw devices to the disk raw /dev/raw/raw1 /dev/sdb1

## display raw devices raw -qa df -k df -h bdf df [-egiklnvfb] df -k lsfs [<filesystem>] lsfs -q <filesystem> (detailed) crfs -v jfs2 -d data02lv -m /data02 -A yes

mkfs -t ext3 /dev/sdb1

newfs -F vxfs -o largefiles /dev/vg01/rlvol1 mkfs -F vxfs -o largefiles /dev/vg01/rlvol1

-v filesystem type

Note: mkfs and newfs are a pointer to /sbin/fs_wrapper

-d device or logical volume -m mountpoint

-A mount after restart [yes|no] rmfs -ri /data02 -r remove the mountpoint -i display warning before removing chfs -a size=+1G /var (grow by additional 1GB)

tune2fs tune2fs -l /dev/sda1

# change reserved blocks percentage to 1% tune2fs -m 1 /dev/sda1

tunefs -v <filesystem> vxtunefs -v <filesystem> fstyp -v <filesystem> Note: you can perform the following resize # Disk fragmentation freeze fsadm -F vxfs -E / (report) fsadm -F vxfs -e / (defrag) change mountpoint permissions lots more..............................

chfs -a size=1G /var (grow to 1GB in size) chfs

touch /forcefsck shutdown -r now

n/a

tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'

# Look at the second line to see if a filesystem # needs checking tunefs -v <filesystem>

# edit /etc/default/rcS change below so # you dont have to hang around FSCKFIX=yes dump/restore tar dd cpio

cat /boot/grub/menu.lst

fbackup/frecover dump/restore ftio tar dd cpio setboot

backup|restore tar dd cpio

bootinfo -b (display last boot device) bootlist -m [normal|service] -o (display bootable devices)

/boot/grub/menu.lst

setboot -p <primary bootlist -m normal hdisk0 path> hdisk1 setboot -a <alternate path>

/boot/grub/menu.lst

bootlist -m normal hdisk0 hdisk1

# autoboot sequnce setboot -b [on|off] mkboot -l <device>

grub-install <raw-device>

bosboot -a (uses default device) bosboot -ad hdisk1

n/a

Note: we are treating the disk as a LVM device n/a format -d /dev/rfd0 format -d /dev/fd0.18 (high format)

n/a

n/a

mount /dev/rfd0 /floppy

mount -rt iso9660 /dev/cdrom /mnt/cdrom

mount -rF cdfs /dev/dsk/c1t6d0 /cdrom start: /usr/sbin/pps_mount d pps_mount mount_vxfs -o remount,ro <filesystem>

mount -v cdrfs -r /dev/cd0 /cdrom umount /cdrom

umount /mnt/cdrom eject cdrom

mount -o remount,rw /

mount -o remount,rw <filesystem> Note:I did find a note that it should be possible to remount a jfs2 filesystem, but it did not work on my system

n/a

using the grub window append the word singleto the kernel line

recovery tape mksysb (preview) make_tape_recovery v -l -x inc_entire=vg00 /opt/ignite/bin/make_ recovery -ACv enter PDC based on a 9114-275 workstation > search >boot p1 (cdrom) 1. Restart the machine.

using the grub window append the word singleto the kernel line

interact with IPL? Y

2. Wait the the AIX splash screen to come up. Devices begin to initialize here. 3. When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console. 4. Choose default boot list when the maintenance screen comes up.

ISL> hpux -is

f10 or f12

>boot pri interact with IPL? Y ISL> hpux -lm

based on a 9114-275 workstation

1. Restart the machine. 2. Wait the the AIX splash screen to come up. Devices begin to initialize here. 3. When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console. 4. Choose select boot options when the maintenance screen comes up, then option 1, then option 1 for scsi, then option 3 service mode boot

floppy: /dev/fd0 disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom:

floppy: n/a disk: /dev/dsk/c0t6d0 tape: /dev/dsk/rmt/0 cdrom:

floppy: /dev/fd0 /dev/rfd0 disk: /dev/hdisk0 tape: cdrom:

/dev/hda (depends on number of IDE disks)

/dev/dsk/c1t6d0

/dev/cd0

/dev/MAKEDEV <device>

insf -C tape (Class) insf -H 0.1.0 -e (recreate deleted link)

cfgmgr cfgmgr -l scsi0

mkdev # remove all devices rmdev from a hardward path rmsf -k -H 52.6.0 rmdev -l cd0 chdev chdev -l rmt0 -a ret=no lsdev lsdev -Cc disk lsdev -Cc disk -p scsi0 lsslot -c pci -l ent0 lscfg lscfg -l ent0 lscfg -vl fcs0 (find the WWN of HBA adapter) lspath -l hdisk0 getconf DISK_SIZE hdisk1 (detailed)

cat /proc/devices

lsdev

Ubuntu/Debian /etc/network/interfaces

ifconfig

HP AIX /etc/rc.config.d/netco stores information in the nf ODM (Object Database Manager) ioscan -funC lan (list ifconfig -a hardware) lanscan -v (list configured) ifconfig lan0 entstat -d <interface> (individual) lsdev -Cc if lsdev -Cc tcpip

odmget -q "name=en0" CuAt lsattr -EHl en0 ifconfig ifconfig <interface> mktcpip (completely setup a network interface) rmtcpip (remove all network interfaces) # configure an interface mktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i en1 -g 192.168.0.10 -h - hostname assigned to interface -a - ip address -m - netmask -i - interface name -g - gateway ip address # remove an interface ifconfig en1 detach ifconfig (configures IP address) chdev (add aliases to network interface) ifconfig en0 up ifconfig en0 down ifconfig en0 detach (remove)

/sbin/ifup eth0 /sbin/ifdown eth0

ifconfig lan0 up ifconfig lan0 down

note: there is no "ifconfig -a" in hpux use lanscan then "ifconfig <interface>" ethtool -s eth1 speed 100 duplex full ndd -set <device> <parm> <value> chdev -l ent0 -a media_speed=1000_Full_ Duplex -P lanadmin -X <option> chdev -l ent0 -a lan0 media_speed=Auto_Nego tiation -P Note: entX - physical device

ethtool eth0

lanadmin -> lan -> display ## options supported ndd -get /dev/ip ? ndd -get /dev/tcp ? ndd -get /dev/arp ? ndd -get /dev/udp ? netstat -i [-I interface] netstat -s lanscan

enX - frame type run on entX netstat -v entstat -d <interface>

sysctl -a |grep net*

no -a no -o "ipforwarding=1"

netstat -i [-f inet] netstat -s entstat -d <interface> netstat -ia

ifconfig

tcpdump -i <interface>

nettl -start nettl -status all nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LAN nettl -stop

ethereal (needs to be installed)

tcpdump -i <interface> iptrace -i <interface> <output file> ipreport (used with iptrace to view reports)

Note: you must stop the iptrace by using "kill -15" use netfmt to display the trace file edit /etc/network/interfaces /etc/rc.config.d/netco route add 0 <gateway IP nf address> Note: there is no file that holds the default router netstat -rn netstat -rn netstat -r -f inet lsattr -EHl inet0 -a route ifenslave -d bond0 eth1 (detach) You buy an optional smitty etherchannel product called Auto- (creates, deletes and Port Aggragation. tests)

add: gateway <IP address>

netstat -rn route -n

ifenslave bond0 eth1

(reattach) entstat -d ent0

cat /proc/net/bonding/bond0 /etc/hostname set_parms hostname hostname <new (requires reboot) hostname>

set_parms hostname (requires reboot) /etc/hosts chdev -l inet0 -a hostname=<hostname>

sysctl -a |grep hostname

/etc/resolv.conf /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf

/etc/resolv.conf /etc/nsswitch.conf /etc/resolv.conf

/etc/resolv.conf /etc/netsvc.conf /etc/resolv.conf /etc/irs.conf (may not be there) chnamsv (change name service) rmnamsv (remove a name service) lsnamsv -C (list name services) netcdctrl -t dns -e hosts -f

n/a /etc/host /etc/resolv.conf

/etc/rc.config.d/netco domainname nf <domainname>

ip route get <IP address> traceroute Boot (jumpstart) servers: rpcinfo -b bootparam 1

n/a

route -n get <hostname>

Boot (jumpstart) Boot (jumpstart) servers: servers: rpcinfo -b bootparam rpcinfo -b bootparam 1 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1

NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -u <yp server> ypserv

Ubuntu/Debian diskdump netdump

HP edit /stand/system

AIX sysdumpdev -l (list dump destination) sysdumpdev -e (estimates dumpsize)

kdump (part of kexec rpm)

add either: dump 2/0/1.5.0

sysdumpdev -L (info)

/etc/kdump.conf (select where you want the dump to go) service kdump start chkconfig kdump on

dump lvol

sysdumpstart -p (start dump primary) sysdumpstart -s (start dump secondary)

dump none

# crash config file ## to crash the system echo "c" > /proc/sysrq-trigger

# set the dump device permanently /etc/rc.config.d/savec sysdumpdev -p <dump rash device> -P

crash (used to analyse crash dumps)

# analyse dump file echo "stat\n status\n t m" | crash /var/adm/ras/vmcore.0

Ubuntu/Debian top sar mpstat w (load average) top sar

HP

AIX topas -P topas -L (logical partitions) mpstat sar -c w (load average) uptime (load average) lparstat ps iostat -tT 1 tprof curt topas vmstat sar -b svmon ps ipcs -a lockstat (version 4) rmss [ent|tok|fddi|atm]stat netstat

uptime (load average) ps vmstat procinfo cat /proc/cpuinfo

w (load average) uptime (load average) ps vmstat glance sam

free vmstat top procinfo slabtop sar cat /proc/meminfo ethtool mii-tool

top vmstat sar sam glance

netstat lanadmin

netstat lsof tcpdump ip iptraf sar -d iostat vmstat lsof

sam glance

netpmon (trcstop to stop trace)

iostat sar sam glance

topas -D (disk) topas -F (filesystem) iostat sar -D fcstat (fibre) lvmstat filemon (trcstop to stop) fileplace # disk stat history chdev -l sys0 -a iostat=true lsattr -HEl sys0 -a iostat topas truss sar probevue tprof svmon -P <pid> nfsstat

strace -p <pid>

download and install tusc tusc -p <pid>

nfsstat

nfsstat

Ubuntu/Debian cat /proc/modules (more detailed) lsmod Location: /lib/modules/`uname -r`/kernel/drivers

HP kmadmin -k genkex

AIX

Config: /etc/modprobe.d/options /etc/modprobe.d modprobe <module> insmod modprobe -r <module> kmadmin -L <module name> kmadmin -U <module name> n/a n/a

n/a rmmod /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename> kmadmin -u <module id> kcweb (11i) kctune (11i only) rebuild kernel (< 11i see below) chdev -l sys0 -a <parameter>=<value> no -a vmo -a memory) nfso -a ioo -a (network) (virtual (NFS) (Input/Ouput)

sysctl -w param=value

No reboot (dynamically):

raso -a (reliability, availability, serviceability) schedo -a (processor scheduler)

echo "250 32000 100 28" > /proc/sys/kernel/sem echo "536870912" > /proc/sys/kernel/shmmax echo "4096" > /proc/sys/kernel/shmmni echo "2097152" > /proc/sys/kernel/shmall etc.............................................

vi /etc/security/limits cd /etc/tunables

tunchange, tundefault, tunsave, tunrestore, tuncheck Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted sysctl -a cat /etc/sysctl.conf kctune (11i only) sysdef kmtune lsattr -EHl sys0 Note: only a few kernel parameters can be changed

cat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax

kmsystem /usr/sam/lbin/getkinf o -f /stand/vmunix -o /tmp/kernel.data

etc................................... cd /stand/build chdev -l sys0 -a <parameter>=<value>

/usr/lbin/sysadm/syst em_prep -v -s system edit system file Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted

/usr/sbin/mk_kernel s ./system mv /stand/system /stand/system.old mv /stand/vmunix /stand/vmunix.old mv /stand/build/system /stand mv /stand/build/vmunix_ test /stand/vmunix reboot

ipcs -a

ipcs -a

ipcs -a

Ubuntu/Debian There is no services or chkconfig command use the old fashioned way /etc/init.d/<service>

HP There is no services or lssrc -a chkconfig command use the old fashioned way /sbin/init.d/<service>

AIX

startsrc -s <subsystem> startsrc -g <group> stopsrc -s <subsystem> stopsrc -g <group> refresh -s <subsystem> stopsrc -s <subsystem> startsrc -s <subsystem> lssrc -a n/a

n/a /var/adm/ras /etc/syslog.conf /etc/rc.tcpip n/a

Ubuntu/Debian

HP swlist -l bundle swlist -l product swlist -l patch swcopy (install patch into depot) swinstall (install patch from depot) Note: the swagentd daemon must be running swremove installp -r instfix -ia

AIX

instfix -k

dpkg -l dpkg -S <search string> (search) dpkg -S <filename> (file belongs) dpkg -s <package> (status) dpkg -p <package> (detailed)

swlist -l bundle <bundle> swlist -l product <product>

lslpp -L all (all filesets) lslpp -L <package> (single fileset) lslpp -w <file> (file belongs)

## check a package swlist -s <full_path/software>

lslpp -ha (history of filesets)

rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) oslevel -g (install packkages above os level)

dpkg -i <package>

swinstall swinstall -s <full_path/software>

whereis <filename> which_fileset <filename> installp -a installp -c (cleanup after failed install) rpm -i geninstall (generic installer: installp, RPM, etc)

dpkg -r <package> (do not remove config files) dpkg -P <package> (remove config files)

swremove

installp -u (commited packages) installp -r (applied packages) rpm -e <package>

n/a

geninstall -u <package> swverity <fileset> (see lppchk -v /var/adm/sw/swagent .log) rpm -V <package> swlist -l file <product> lslpp -f <fileset> rpm -ql <package> /usr/lpp /var/lib/rpm ldd <file>

dpkg -L <package> (list files)

/var/lib/dpkg/info

/var/adm/sw

ldd <file>

chatr <file>

Ubuntu/Debian cat /etc/passwd logins -x useradd useradd userdel sam userdel sam usermod sam

HP cat /etc/passwd

AIX cat /etc/passwd lsuser -f ALL (detailed) mkuser useradd rmuser userdel chuser -a usermod passwd -f

usermod

passwd -s chfn <username> usermod chfn <username><shell> passwd pwdadm passwd groupadd groupdel passwd groupadd groupdel pwdck -t ALL mkgroup <group name> rmgroup <group name> chgroup <attribute><group name>

groupmod /etc/passwd /etc/shadow id -a whoami who w finger

groupmod /etc/passwd

/tcb/files/auth/r/root (trusted system) /etc/security/passwd id id whoami who w uptime (displays # of users logged in) finger whoami who w uptime (displays # of users logged in) finger # License information lslicense chlicense # Maximum number of processes for a user lsattr -D -l sys0 -a maxuproc chdev -l sys0 -a maxuproc=<number>

groups

groups setprivgrp

groups setgroups lsgroup ALL

Ubuntu/Debian server: rpc.mountd,nfsd client: rpc.statd, lockd /etc/exports /var/lib/nfs/etab /var/lib/nfs/xtab

HP server: rpc.mountd, nfsd client: rpc.statd, lockd /etc/exports /etc/xtab

AIX server: rpc.mountd, nfsd client: rpc.statd, rpc.lockd /etc/exports /etc/xtab

/var/lib/nfs/rmtab showmount -e localhost /etc/exports (edit and add share, see below example) exportfs -rav (export the shares)

/etc/rmtab showmount -e localhost

/etc/xtab

exportfs showmount -e localhost /etc/rc.config.d/nfsco mknfsexp -d <directory> nf (edit) /etc/exports (edit and mknfsmnt add share) exportfs -a

/etc/init.d/portmap restart /etc/init.d/nfs-kernel-server restart ## /etc/exports example

shareall

/export *(rw,fsid=0,insecure,no_root_squash,sync) /etc/exports (edit and remove share) /etc/rc.config.d/nfsco rmnfsexp -d <directory> nf (edit) (unshares and removes from file) exportfs -au (unshare all) exportfs -u /home/vallep exportfs -u <filesystem>

exportfs -rav (export the shares)

/etc/exports (edit and unshareall remove share) /etc/init.d/portmap start /etc/init.d/nfs-kernel-server start /sbin/init.d/nfs.core start mknfs

/sbin/init.d/nfs.server chnfs start /sbin/init.d/nfs.client start startsrc -s nfsd startsrc -s rpc.mountd /sbin/init.d/nfs.client rmnfs stop /sbin/init.d/nfs.server stop /sbin/init.d/nfs.core stop stopsrc -s nfsd stopsrc -s rpc.mountd lssrc -a |grep -i nfs exportfs -av

/etc/init.d/portmap stop /etc/init.d/nfs-kernel-server stop

/etc/init.d/nfs-kernel-server status exportfs -rav (export the shares)

ps -ef | grep <nfs daemons> exportfs -a

nfsstat cat /var/lib/nfs/etab

nfsstat n/a

nfsstat nfso -a nfso -o <option>=<value> exportfs (display options) n/a

n/a

n/a

Ubuntu/Debian ntpd /etc/default/ntp xntpd

HP xntpd

AIX

/etc/rc.config.d/netd /etc/ntp.conf aemons (set XNTPD to 1) /etc/ntp.conf startsrc -s xntpd stopsrc -s xntpd

/etc/ntp.conf /etc/init.d/ntp [start|stop|restart]

lslpp -L all|grep xntpd

/etc/default/ntp

/etc/rc.config.d/netd startsrc -s xntpd -a "-x" aemons /etc/rc.tcpip ntpq -p ntpq -p ntpdate (set the date) ntptrace ntpdate

ntpq -p ntptrace

Ubuntu/Debian /var/log/messages /var/log/syslog /var/log/mail.* /var/log/cron.log

HP

AIX

/var/adm/syslog/syslo g.log /var/adm/ras /var/adm/syslog/syslo g.log /var/adm/ras /var/adm/syslog/mail .log /usr/spool/mqueue/syslog /var/adm/cron/log /var/adm/cron/log

/var/log/boot dmesg

/var/adm/syslog/syslo g.log /var/adm/ras dmesg alog -o -t boot alog -o -t console alog -L (list all the logs available) /usr/lib/errdemon -l (display attributes) /usr/lib/errdemon (start error logging) /usr/lib/errstop (stop error logging) # use with above errorlog file errpt (summary errorlog report) errpt -a (detailed errorlog report) errpt -j <identifier> (single errorlog report) errclear (clears errorlog) errclear -d <class><days> (clears class errors) errlogger "message upto 230 chars"

logger

logger

Ubuntu/Debian pwck grpck # No reboot required pwck grpck

HP usrck -t ALL grpck

AIX pwdck -t ALL

# No reboot required # No reboot required /etc/securetty /etc/security/user

/etc/securetty

Note: you may need to chsec -f /etc/security/user -s root create this file if it does not exist

Ubuntu/Debian grub (GUI)

HP setboot -p <primary path> setboot -a <alternate path> # autoboot sequnce setboot -b [on|off] shutdown -h now (halt) shutdown -r now(reboot)

AIX bootlist -m normal hdisk0 hdisk1

shutdown -h (halt) shutdown -r (reboot) shutdown -P (power off)

shutdown -F (fast shutdown) shutdown -Fr (fast shutdown and reboot)

touch /forcefsck # edit /etc/default/rcS change below so # you dont have to hang around FSCKFIX=yes halt init poweroff reboot shutdown telinit

init reboot shutdown

init shutdown reboot telinit halt

0 - halt 1 - single user 2 - multiuser (default) 3 - same as 2

0 - halt 1 - single users 2 - multiuser (networking)

0 - reserved 1 - reserved 2 - multiuser mode with NFS

3 - multiuser 3 - user defined (networking, NFS, and CDE GUI) (default) 4 - multiuser (netwrking, NFS, and VUE GUI) 5 - n/a 6 - n/a 4 - user defined

4 - same as 2

5 - same as 2 6 - reboot

5 - user defined 6 - user defined 7-9 - user defined # change default - change the initdefault line

# change default - change all the telinit

# change default change the initdefault line vi /etc/inittab interact with IPL? Y

vi /etc/inittab

vi /etc/event.d/rc-default single - use grub to edit kernel line emergency - use grub to edit kernel line linux rescue - use at the boot prompt

Based on 9114-275 workstation

# single user ISL> hpux -is

1. switch off the machine

single: runlevel1, local fs mounted, no network emergency: root fs read-only, no init files run rescue: use cd-rom/network, root mounted as /mnt/sysimage # Logical volume maintanence mode ISL> hpux -lm

2. power on and enter the SMS menu

Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker

/etc/init.d

# No quroum check ISL> hpux -lq /sbin/init.d /etc/rc.config.d (startup config files)

/etc/rc.d /etc/rc.d/init.d

/etc/rc0.d - /etc/rc6.d /sbin/rc0.d /sbin/rc6.d /etc/rc.d/rc2.d - rc9.d

/etc/rc.* (config files for auto-starting) also uses the System Resource Controller F10 or F12 interact with IPL? Y Based on a 9114-275 workstation 1. switch off the machine 2. power on and enter the SMS menu

Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker

Boot sequence 1. BIOS

Phases: 1. PDC - processordependent code; executes and performs self-tests

Phases: Read Only Storage (ROS): check the system board, perform POST, locate and load boot image, begin system initialization and execute phase 1 of the /etc/rc.boot script Base Device Configuration: start configuration manager to configue base devices System Boot: start init process phase 2, switch to hard-disk root filesystem, start other processes defined by /etc/inittab and execute phase 3 of the /etc/rc.boot script

2. POST

2. ISL - initial system loader; loads the secondary system loader hpux 3. HPUX - is the secondary system loader and loads the kernel /stand/vmunix, then hands over to the kernel 4. KERNEL - swapper processes are started by the kernel then starts the init process 5. INIT - reads /etc/inittab

3. Master Boot Record (MBR) - point to the bootloader GRUB or LILO

4. GRUB (stage 1) - point to GRUB stage 1_5

5. GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files

6. GRUB (stage 2) reads /boot/grub/menu.lst and displays the grub menu, it specifies the kernel and the initrd files

7. KERNEL - control given to the kernel 8. INIT - runs the /etc/event.d/rc-default script

runlevel who -r /etc/event.d/rc-default locale -a

who -r /etc/inittab locale -a n/a

who -r /etc/inittab locale -a n/a

set_parms install_assist [initial|hostname|ip_a ddress|timezone] Note: set_parms is in /sbin /etc/timezone /usr/share/zoneinfo/zone.tab /etc/TIMEZONE /etc/environment /etc/profile

Command Description Server Release info

Solaris cat /etc/release

Red Hat cat /etc/enterprise-release

Ubuntu/Debian cat /etc/lsb-release

HP-UX AIX /stand/kernrel

Você também pode gostar