This is *COPY* of : http://www.gombadi.com/knowledge.html

Or to put it another way
dd if=/dev/brain of=/dev/internet

If you have a good browser then use CTRL-f to find what you want

As always this page will grow and change as time goes by
I have gathered this information from a lot of places around the Internet and from my own experience. Feel free to pass on any tips or corrections you may have.

KVM
How I compiled the kernel module and got it to run in bridge mode
I started from a standard Ubuntu 7.04 install on an Intel Core2 Duo machine
apt-get install gcc-3.4 g++-3.4 uuid-dev zlib1g-dev libsdl1.2-dev build-essential
apt-get install libasound2-dev bridge-utils qemu vde
Change /etc/network/interface to look like this so bridge mode works
auto lo eth0 br0

iface lo inet loopback

iface br0 inet dhcp
        bridge_ports eth0
        bridge_maxwait 2
        #kvm has to have this set to 0.0.0.0 to work... not sure why
        #not sure if promisc is necessary
        up /sbin/ifconfig eth0 inet 0.0.0.0 promisc
        
#set to something random, br0 initialization will undo this
iface eth0 inet static
        address 172.16.5.0
        netmask 255.255.255.0

then restart networking
Now compile the module
tar -xzvf kvm-27.tar.gz
./configure --prefix=/usr/local/kvm
make
make install
modprobe kvm-intel
I had to modify the /etc/qemu-ifup file to
cat /etc/qemu-ifup
#!/bin/sh
#sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1

# modified to bridge everything
/sbin/ifconfig $1 up
/usr/sbin/brctl addif br0 $1
Make a disk image file and install the operating system
qemu-img create /some/path/to/the/image/file/centos5-64.img -f qcow 6G
/usr/local/kvm/bin/qemu-system-x86_64 -hda centos5-64.img -cdrom /some/path/to/the/iso/file/CentOS-5.0-x86_64-bin-DVD.iso -boot d  -m 384
Now start the virtual machine
/usr/local/kvm/bin/qemu-system-x86_64 -m 384 -net nic,vlan=0 -net tap,vlan=0 /some/path/to/the/image/file/centos5-64.img
I also created the following script to start the kvm environment after a boot
#!/bin/bash

#Load things and start kvm

echo "Loading modules"
modprobe kvm-intel
modprobe tun

echo "Sleeping to set things up"
sleep 3

echo "Changing permissions etc on devices"
chgrp kvm /dev/kvm
chmod 0660 /dev/kvm

chgrp kvm /dev/net/tun
chmod 0660 /dev/net/tun

echo "set max-user-freq to stop kvm complaining"
echo 1024 > /proc/sys/dev/rtc/max-user-freq

echo "All done"


Openvz
Compile a kernel
Install all Pre reqs
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
Now follow this with changes to suit your system, kernel version and Openvz patch name etc
You will need the following -
cd /somewhere/useful
wget http://www.kernel.org/pub/linux/kernel/v2.6/[kernel that matches the patch below].tar.bz2
tar xjf [kernel version].tar.bz2
cd into the kernel source directory

# Get the patch from openvz.org download page
gzip -d patch-?????-combined.gz
patch -p1 < patch-?????-combined

make menuconfig
# Select load an alternate configuration file
# make other changes as required for the system

make-kpkg clean

time fakeroot make-kpkg --initrd --revision=OpenVZ.[kernel version] kernel_image kernel_headers

cd ..

dpkg -i [debian kernel package].deb

shutdown -r now
Add this to sources list for binary versions of the vzctl etc commands. They also have binary kernels if you don't want to compile your own but who would want to miss compiling their own kernel.
deb http://debian.systs.org/ stable openvz
Then
apt-get update
apt-get install vzctl vzquota
Create a vps from a Template
To use a pre-configured template
cd /vz/template/cache
wget http://download.openvz.org/template/precreated/[template name]tar.gz
ID needs to be greater than 100 and unique (e.g. 1??)
vzctl create 1?? --ostemplate [template name without .tar.gz] --config vps.basic
vzctl set 1?? --onboot yes --save
vzctl set 1?? --hostname host.name.com --save
vzctl set 1?? --ipadd 192.168.x.y --save
vzctl set 1?? --nameserver 192.168.x.z --save
vzctl start 1??
VPS should now be running. To confirm try these
vzctl exec 1?? ps fauwx
vzctl exec 1?? passwd
vzctl status 1??
vzctl stop 1??
vzlist -a
To see beancounter values on the hardware node
cat /proc/user_beancounters
To set a value
vzctl set 1?? --[name from /proc/user_beancounters] xxx:yyy --save
Install a new Debian/Ubuntu image
The Ubuntu version will allow both Debian and Ubuntu installs
This has not been tested in a while and there may be better version else where on the Internet
apt-get install debootstrap
debootstrap --arch i386 [ubuntu version] /vz/private/1?? http://archive.ubuntulinux.org/ubuntu
vzctl set 1?? --applyconfig vps.basic --save

Set the name of the template:
echo "OSTEMPLATE=ubuntu-?.?" >> /etc/vz/1??.conf

# Ignore this if it shows - Warning: configuration file for distribution ubuntu-?-? not found default used

vzctl set 1?? --ipadd 192.168.x.y --save
vzctl set 1?? --nameserver 192.168.x.z --save

Update the sources list in /vz/private/1??/etc/apt/sources.list if needed

vzctl start 1??

vzctl exec 1?? apt-get update
vzctl exec 1?? apt-get -u upgrade
vzctl exec 1?? apt-get install ssh libedit2 openssh-client openssh-server

vzctl exec 1?? sed -i -e '/getty/d' /etc/inittab

vzctl exec 1?? rm -f /etc/mtab
vzctl exec 1?? ln -s /proc/mounts /etc/mtab

### Now the vps is ready to either run or to create a template

vzctl set 1?? --ipdel all --save
vzctl stop 1??

cd /vz/private/1??
tar czf /vz/template/cache/ubuntu-?.?-minimal.tar.gz .

# now cleanup
vzctl destroy 1??

To deploy use -
vzctl create 10? --ostemplate ubuntu-?.?-minimal --config vps.basic
Misc
To get a Centos 5 physical to VE system to enable vzctl enter I had to comment out starting udev in /etc/rc.sysinit in the VE
Linux
Misc
To find stuff about your motherboard in Linux As root
dmidecode
Knoppix tricks
Copy a disk from a machine to another using knoppix and ssh. This will copy the complete disk from the source to a file on the destination. Good if you want to make a backup of the complete disk.
Warning - Uses a lot of room on the destination machine
dd if=/dev/hda? | gzip -c | ssh user@other-machine "cat >/path/to/save/to/filename"
To restore the disk image boot the machine with knoppix and set a root password and start ssh service then on the machine with the image file
cat /path/to/filename | ssh user@knoppix-machine "gzip -c | dd of=/dev/hda?"
Re-install lilo from Knoppix
Boot the system from Knoppix and type knoppix 2 from the boot prompt then from the command prompt
mount -o dev /mnt/???
chroot /mnt/??? lilo
Start a raid array from Knoppix
If you know what partitions are part of the array
modprobe md
modprobe raid1
mdadm /dev/md? --run /dev/sd?? /dev/sd??
mount /dev/md0 /mnt/md0
or if you do not know what goes where
mdadm --examine --scan /dev/hd?? >> /etc/mdadm/mdadm.conf
vim /etc/mdadm/mdadm.conf # edit file to remove rubbish
mdadm --assemble --scan
To stop the above arrays before shutdown
mdadm --stop --scan
SSL stuff
To see the contents of a certificate
openssl x509 -in filename -text -inform DER (or could be PEM or NET)
To convert a DER to a PEM format
openssl x509 -in infile.name -inform DER -out outfile.name -outform PEM
To connect to a remote HTTPS server and view the certificate they use and the certificate chain
openssl s_client -showcerts -connect 1.2.3.4:443
MySQL Stuff
Set root password
mysqladmin -u root password 'somepassword'
Apache Rewrite stuff
The following does - uri containing only /admin-portal OR /admin-publish then add a trailing slash. This is the [L]ast rule and also do an external [R]edirect instead of a local one (i.e. don't just change the file to look for but send an HTTP 302 Temporary moved to get the browser to request again.)
RewriteCond %{REQUEST_URI} ^/admin-portal$ [OR]
RewriteCond %{REQUEST_URI} ^/admin-publish$
RewriteRule (.*)        $1/ [L,R]
NFS mounts
In /etc/exports add these
/path/to/share    192.168.0.0/255.255.255.0(rw,no_root_squash,sync)
/path/to/share2   192.168.0.0/255.255.255.0(rw,anonuid=123,anongid=321)
To mount the share use -
mount server:/path/to/share /place/to/mount
Mount command examples
where type is ext2, ext3, reiserfs,vfat,ntfs,iso9660 etc
mount -t type /dev/hd[abcd] /place/to/mount
mount -o remount ro /mnt/point
umount /mnt/point
Grub things
To load a particular kernel go to grub command line and
kernel /boot/kernel_name root=/dev/hda?
initrd /boot/initrd_name   (optional?)
boot
Install grub from Knoppix
grub-install --root-directory=/mnt/hda1 /dev/hda
Install grub to both disks in a raid 1 array
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> root(hd1,0)
grub> setup (hd1)
grub> quit
Sample /boot/grub/menu.lst file
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-version.img
#boot=/dev/sda
#default=0
default saved
fallback 1 2 3
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu

title Debian Openvz-2.6.18
        root (hd0,0)
# see note above about relative path
        kernel /vmlinuz-2.6.18-028stab035 ro root=/dev/sda?
        initrd /initrd.img-2.6.18-028stab035
        savedefault fallback
title Debian
        root (hd0,0)
# see note above about relative path
        kernel /vmlinuz-2.6.17-2-686 ro root=/dev/sda?
        initrd /initrd.img-2.6.17-2-686
        savedefault fallback
title Debian Rimuhosting
        root (hd0,0)
# see note above about relative path
        kernel /vmlinuz-2.6.9-34.EL ro root=/dev/sda? panic=30
        initrd /initrd-2.6.9-34.EL.img
title CentOS-4 i386 (2.6.9-34.EL)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-34.EL ro root=LABEL=/
        initrd /initrd-2.6.9-34.EL.img
LILO errors
L number    Usually media failure
LI          1st stage OK, 2nd stage no go. Geometry mismatch or can't find /boot/boot.b
LIL         Can't laod map file - usually media failure
LIL?        2nd stage loaded at incorrect address - see LI
LIL-        Corupt description table, geometry mismatch or can't find map file
Linux Route command examples
route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.100.100
route del -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.100.100
route add -net 192.168.171.0 netmask 255.255.255.0 gw 192.168.0.250

route add default gw 192.168.100.254
route del default gw 192.168.100.254
Serial ports
Debian serial ports
/var/lib/setserial/autoserial.conf
###PORT STATE GENERATED USING AUTOSAVE-ONCE###
###AUTOSAVE-ONCE###
#KERNEL
/dev/ttyS0 uart undefined port 0x03f8 irq 4 baud_base 921600 spd_normal skip_test
/dev/ttyS1 uart 16550A port 0xccb8 irq 169 baud_base 115200 spd_normal skip_test
/dev/ttyS2 uart 16550A port 0xcca8 irq 169 baud_base 115200 spd_normal skip_test
To change
dpkg-reconfigure setserial

udev
Have a look here for various rules
/etc/udev/rules.d
/etc/fstab examples
Have not had to touch this in a few years but if you need to then this is how it may look
/dev/hda1       /               ext3    errors=remount-ro       0       1
/dev/hda2       none            swap    sw                      0       2
/dev/hdc2       /mnt/mail       reiserfs        defaults        0       2
proc            /proc           proc    defaults                0       0
/dev/fd0        /floppy         auto    user,noauto             0       0
/dev/cdrom      /cdrom          iso9660 ro,user,noauto          0       0
/dev/sda1       /mnt/usb        auto    rw,user,noauto,noatime  0       0
Ubuntu and Debian interfaces examples.
auto eth0
iface eth0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.254
auto eth1
iface eth1 inet dhcp
Set eth port to 10Mb full duplex
From command line -
ethtool -s eth0 speed 10 duplex full autoneg off

On boot in Centos add this to /etc/sysconfig/network-scripts/ifcfg-eth0
ETHTOOL_OPTS="speed 10 duplex full autoneg off"

Misc Bash things for scripts etc
# to remove all comments from a file
awk '{sub(/#.*$/,""); if(NF>0) print}' < filename
# String editing # get the path to the file
echo /a/b/c
echo !$:h gives -
/a/b

echo /a/b/bob.c
echo !$:r gives -
bob

echo /a/b/bob.c
echo !$:t gives -
bob.c
display mx hosts for domains
function mx() {

    for host
    do
        echo "----  $host  ----"
        dig +short "$host" mx | sort -n
    done

}
# script snipits
do_some_command with arguments || {
    echo "Error message"
    exit 1
}
Find examples
Look for programs with no executable on disk
file /proc/[0-9]*/exe | grep '(deleted)'
Files with SUID bit set
find / -user root -perm -4000 -ls
Files with SUID & SGID bit set
find / -user root -perm -6000 -ls
Find files older than 5 days and remove them
find . -mtime +5 -type f -exec rm \{\} \;
Files with suspect UID or GID values and save to a file
find / ! '(' -fstype proc -o -fstype nfs ')' '(' -nouser -o -nogroup ')' -ls 2>/dev/null >>/some/file/to/save
remove some files
find . -type f \( -name \*.200??????? -o -name \*200????? \) -exec rm {} \;
Directories using a large amount of disk
find . -type d -exec du -sh \{\} \; | grep [0-9]G
change do transport to 0 for all files in a dir
for f in *; do sed 's/DO_TRANSPORT=1/DO_TRANSPORT=0/'< $f >bobit; mv bobit $f; done
tar.gz a file to a remote system
tar -czf - . | ssh user@host "cat >/export/home/user/baldrick/opt-partition.tar.gz"
find directories that are using a log of space
find . -type d -exec du -sh \{\} \; | grep [0-9]G
fix permissions on tx releases
grep ^cp releaseOP2187.0.sh | grep -v { | awk '{print $4}' | xargs -i chown nobody:nogroup \{\}
grep ^cp releaseOP2187.0.sh | grep -v { | awk '{print $4}' | xargs -i chmod o-r \{\}
add a -p option to the cp command on some lines in a file
cat releaseOP2112.0.sh.orig | perl -ne '(/^cp.(\".*\})$/) ? (print "cp -p $1\n") : (print $_)' >releaseOP2112.0.sh
fast find - use as >> ff ch09 << to find file or dir containing the string
alias ff "find . -name '*\!{*}' -ls"
find different types of files and dirs and do something different with each type
find . \( -type d   -a -exec chmod 771 {} \; \) -o \
    \( -name "*.BAK" -a -exec chmod 600 {} \; \) -o \
    \( -name "*.sh" -a -exec chmod 755 {} \; \) -o \
    \( -name "*.txt" -a -exec chmod 644 {} \; \)
duplicate an empty directory tree from an existing tree
find . -type d -print | sed 's@^@/new/dir/tree/@' | xargs mkdir
alias to find files in the current dir
alias find. 'find . \( -type d ! -name . -prune \) -o \( \!* -print \)'
alias find.ls 'find . \( -type d ! -name . -prune \) -o \( \!* -ls \)'
ufs Restore on a linux system
Get a command prompt within the dump
restore -i -f ufsdump_filename
Use cd, pwd, extract etc to have a look around
then to restore a file
restore -x -a -f ufsdump_filename path/and/file/to/restore
Clocks
Query connections on an ntp server
ntpdc -c monlist
Query peers on an ntp server
ntpq -pn
Set the hardware clock
hwclock --utc --set -date "yyyy-mm-dd hh:mm"
or use --localtime instead of --utc
update the system time and also update the hardware clock. Make it a cron job
ntpdate serveraddress; hwclock --adjust --systohc
/etc/inetd.conf
Example layout
ftp     stream      tcp     nowait      root    /usr/sbin/tcpd      /usr/sbin/in.ftpd
Hard Disk data
This will display data about the transfer rates for the drive
hdparm -Tt /dev/hda - This will display data about the transfer rates for the
Boot the AlphaServer 800
The flags is an index into the line in /etc/aboot.conf to boot from. It is like lilo but for the alpha.
To boot from the CD-Rom
>>>boot dka4 -flags 0
To boot from the first SCSI disk
>>>boot dka0 -flags 0
Perl Modules
To setup and config the system first.
perl -MCPAN -e shell
To add perl modules to a system - will install the Mail::Mailer module. This must be run as root as it first downloads and then installs the package.
perl -MCPAN -e 'install Mail::Mailer'
To convert from unix time to local time with perl
where xxxxxx is a number like 1137991048
perl -le 'print scalar localtime shift' xxxxxxx
Change the colour of directory listings
Edit the DIR_COLORS file in /etc or add a .dir_colors file to your $HOME
Apache virtual host config
NameVirtualHost *

#### NOTE!!! This entry must be first so any connection that does
# not match a virtualhost name will match the default (first) server.

    ServerAdmin webmaster@domain.com
    DocumentRoot /path/to/doc/root/for/this/server
    ServerName www.domain.com



    ServerAdmin webmaster@otherdomain.com
    DocumentRoot /path/to/other/domain/root
    ServerName www.otherdomain.com



    ServerAdmin webmaster@moredomains.com
    DocumentRoot /path/to/you/know/where
    ServerName www.guesswhere.com

Postfix configuration
Added the following lines to main.cf
# added to reject sus looking connections
# notify_classes = bounce
disable_vrfy_command = yes

smtpd_recipient_restrictions = reject_invalid_hostname,
                reject_non_fqdn_hostname,
                reject_non_fqdn_sender,
                reject_non_fqdn_recipient,
                reject_unknown_sender_domain,
                reject_unknown_recipient_domain,
                reject_unknown_client,
                reject_unknown_sender_domain,
                reject_unauth_destination,
                permit_mynetworks,
                permit

smtpd_client_restrictions = reject_unknown_client,
                permit

smtpd_sender_restrictions = reject_unknown_sender_domain,
                reject_invalid_hostname,
                reject_non_fqdn_hostname,
                reject_non_fqdn_sender,
                permit

unknown_address_reject_code = 554
unknown_hostname_reject_code = 554
unknown_client_reject_code = 554

smtpd_helo_required = yes
strict_rfc821_envelopes = yes

maximal_queue_lifetime = 1d

unknown_local_recipient_reject_code = 554
Other commands To display the current mail queues
postqueue -p
To flush the queues
postqueue -f
To delete a message from the mail queue.
postsuper -d 
Samba
Make sure that password encryption is set so it works with 2000. Also may need to add user to smbpasswd file. i.e. as root type -
smbpasswd -A username
Add the following parts to smb.conf
[stuff]
    comment = stuff
    path = /stuff
    public = no
    writable = yes
    read only = no
    create mask = 0600

[bkup]
    comment = bkup
    path = /bkup
    public = yes
    writable = no
    read only yes
How to mount a samba share in linux
mount -t smbfs -o username=????,password=?????? //computer/sharename /mnt/mountdir
cdrecord things
To scan the bus
cdrecord dev=ATAPI:0,1,0 -scanbus
To blank a disc -
cdrecord blank=fast dev=ATAPI:0,1,0
To write an iso to disc
cdrecord speed=x dev=ATAPI:0,1,0 -data /path/to/iso/file
Compile a kernel
unpack the sources
cd to dir
make clean
make mrproper  # this will delete the old config file so save it if you need it
make menuconfig
make 
make install
# this may already be done for you
config grub/lilo
Or the Debian way
Get the kernel package kernel-source-2.4.20 etc
make sure you have the following packages
kernel-package debhelper dpkg-dev libncurses5-dev
and then -
make oldconfig
make menuconfig
make dep
make-kpkg clean
make-kpkg --initrd --revision=2:hostname.1.0 kernel_image
Raid systems
apt-get install mdadm lvm2 dmsetup

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
lvm stuff
Create the physical volume and the volume group
pvcreate /dev/hda3
vgcreate xen /dev/hda3
# for a 5GB logical volume named dom1 in volume group xen
lvcreate -L5000 -ndom1 xen
# and a swap partition
lvcreate -L500 -nswap1 xen
# shapshot. size of 1G has to cover the amount of changes in original while snapshot exists
lvcreate -s L1000 -nbackup /dev/xen/name_of_existing_lv_to_take_snapshot_of
iSCSI Stuff
Target

Install iSCSI Enterprise Target stuff for current system and kernel Edit /etc/ietd.conf to have at least this (modify for your own likes)-

Target iqn.2007-06.com.example:stuff.iscsi0
        Lun 0 Path=/dev/stuff/iscsi0,Type=fileio
Initiator (e.g. Centos 4.4)
yum install iscsi-initiator-utils
Edit the /etc/iscsi.conf file to have at least -
DiscoveryAddress=192.168.x.y
On initiator
cat /proc/scsi/scsi to make sure disk shows up and also iscsi-ls

Use fdisk to create the partition on the blank block device.

Make an iso from a file directory
mkisofs -J -R -v -T -o dvd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 8 -boot-info-table directory/
This will make a bootable CD from a bootable floppy
Format a floppy with -
mke2fs /dev/fd0
then copy the file -
cat /home/user/stuff/files/eb-5.0.8-rtl8139.lzdsk >/dev/fd0
And to make a bootable cd from this -
make a temp dir somewhere
make a boot dir under the temp dir
cd to boot dir and run -
dd if=/dev/fd0 of=boot.img bs=18k
This will copy the floppy to the image file. (2880+0 records if 1.4MB floppy)
Then from the temp dir -
mkisofs -r -b boot/boot.img -c boot/catalog -o bootcd.iso .
### Note the final . is needed above ###
boot.catalog is auto generated.
Burn the iso to a cd and away we go.
How to create and copy a floppy disk larger than 1.4MB
New disk - fdformat /dev/fd0u1680
dd if=/home/user/stuff/files/name_of_disk.fd0u1680 of=/dev/fd0u1860
To backup a large floppy disk -
dd if=/dev/fd0/u1680 of=/tmp/name_of_file.fd0u1680
For a 1680 disk it should do 3360+0 records in and out
Quota system
To get quota's working on Red Hat based system do -
Edit fstab file to add usrquota to options
Reboot
quotacheck -cv[m] /dev/hda?     The m option is used if using the root file system
quotaon /dev/hda?
edquota 
repquota -a    to get a report of file usage.
On Debian systems -
apt-get install quota quotatool
Edit fstab as above and reboot
edquota 
repquota -a    to get a report of file usage.
Sendmail
To check what sendmail will do with a message addressed to a user
sendmail -bv user@host
To check parsing for a user
sendmail -bt
/parse user@host
/quit
To set the domain for an outgoing user
edit /etc/mail/generics-domains to add the domain they are currently connecting from
edit /etc/mail/genericstable and add this type of thing
usertochange newuser@newdomain
Show number of connections on a system
while true; do date;netstat -nt | awk '/^tcp/ {print $6}' | sort | uniq -c| sort -k2; sleep 5; done

Solaris
ZFS
zfs tasks Just enter zpool or zfs to get a help screen. Here are some commands that are often useful.
zpool create stuff c0d0s0
zpool create stuff mirror c0d0s3 c1d0s0
zfs create stuff/www
zfs set mountpoint=/var/www stuff/www
zfs create stuff/home
zfs set mountpoint=/export/home stuff/home
zfs create stuff/home/peter
zfs create stuff/home/paul
zfs create stuff/home/mary
zfs set compression=on stuff/home
zfs set quota=5g stuff/home/paul
zfs set reservation=10g stuff/home/mary
zfs set sharenfs=rw stuff/home
zpool scrub stuff
zpool add stuff mirror c3d0s4 c4d1s2
Boot Solaris in single user mode
At grub screen
type e to edit
select entry to boot edit and type e
add -s to end, exit edit mode and reboot
Sun ILOM on v20z
To start the console -
platform console

To power on/off the system -
platform set power state on
platform set power state off

To display the mac address -
platform get mac

Sun ILOM on x4100
To set static ip address -
log in
cd /SP/network
set pendingipaddrss=x.x.x.x
set pendingnetmask=255.255.255.x
set pendinggateway=y.y.y.y
set commitpending=true

show /SP/network

To get to the console -
start /SP/console

To exit from console -
ESC-SHIFT-9

To power on/off and reset the system -
start /SYS
stop /SYS
reset /SYS

show /SYS

To reboot the ilom -
reset /SP

Mount an iso image
Make the block device with loviadm:
lofiadm -a /path/to//file.iso /dev/lofi/1

Mount the image as a read-only filesystem:
mount -F hsfs -o ro /dev/lofi/1 /mountpoint
Mount CDROM
mount -F hsfs -o nomaplcase,ro /dev/sr0 /cdrom
Find what code will run on system 32 or 64 bit
isainfo -v
Duplicate disk partition information
prtvtoc /dev/rdsk/c?t?d?s? | fmthard -s - /dev/rdsk/c?t?d?s?
Find files installed by packages
Grep for filename in -
/var/sadm/install/contents
Jumpstart
Network boot a server and install from jumpstart

Control Break (CTRL-a f in minicom)
at the ok prompt type

boot net - install
Change IP address on Solaris 10
Edit the following files
/etc/hosts
/etc/inet/ipnodes
To change the default router ( default gateway )
Edit this file
/etc/defaultrouter
To change the hostname edit -
/etc/hosts
/etc/nodename
/etc/hostname.{interface name}
To get the interface name type ( i.e. hme0, bge0 ) -
prtconf -D | grep network
Add an ip alias
fconfig bge0:1 plumb
ifconfig bge0:1 192.168.1.2
ifconfig bge0:1 up

use it

ifconfig bge0:1 down
ifconfig bge0:1 unplumb
SVM Raid a partition
Make sure both disks have the same partition layout and create slices for the replica database (2 cylinders)
format
Set the active partition for the disks
fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c?t?d?p?
If making root partition raid then make second disk bootable
/sbin/installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c?t?d?s?
Add the State Database Replicas to a slice (normally s7) - may need -f to force if partition mounted
metadb -a -f c?t?d?s?
Need more than one copy. Spread accross disks/controllers etc - see docs for details
metadb -a -f c?+1t?d?s?
We will use d0 with d10 and d20 as the two mirrors
Initialise the first mirror in the array. -f to force and "1 1" for one stripe and one slice
metainit -f d10 1 1 c?t?d?s?
Initialise the second mirror in the array
metainit d20 1 1 c?t?d?s?
Add the first mirror to the raid array
metainit d0 -m d10
If doing the root partition this will update /etc/vfstab to point to new root partition location. If doing non-root partitions then vi the file
metaroot d0
Reboot so system uses half of the new raid 1 array
reboot
Add the second mirror to the raid array
metattach d0 d20
To check on the status of the array
metastat
Misc commands
To delete an SDR
metadb -d -f c?t?d?s?

Detach a mirror from an array
metadetach d0 d10

Take mirror off line
metaoffline d0 d20

Put mirror back in array and resync
metaonline d0 d20

Create a UFS file system on the new array
newfs /dev/md/dsk/d?

Backup your metadb information
metastat -p > /etc/lvm/md.tab
Live update
Pre-req's
Read the Sun docs. There are many different options available and forward planning is the best solution.
My setup -
Current root exists on SVM raid 1 array using c?t?d?s0 on two disks
New boot ebvironment was to use SVM and c?t?d?s3 on the same disks

Create the new boot environment

lucreate  -c "be1" -m /:/dev/md/dsk/d10:ufs,mirror -m /:/dev/dsk/c?t?d?s3:attach  -m /:/dev/dsk/c?t?d?s3:attach -n "be2"
Above does:
- Create new boot environment be2
- Name existing environment be1
- create raid array called d10 and make it ufs
- add c?t?d?s3 of two disks to the array
See how things went
lustatus
Change to the new boot environment
luactivate be2
init 6
Live update from Solaris 10 to Solaris Express
To upgrade from Solaris 10 to Solaris Express
Create a new boot environment as above then mount the iso image. Then install the live update packages from Solaris Express
/mnt/Solaris_11/Tools/Installers/liveupgrade20 -noconsole -nodisplay
Now upgrade the new boot environment
luupgrade -u -n be2 -s /mnt
Change to the new boot environment
luactivate be2
init 6
DTrace
DTrace Oneliners # New processes with arguments,
dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }'
# Files opened by process,
dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'
# Syscall count by program,
dtrace -n 'syscall:::entry { @num[execname] = count(); }'
# Syscall count by syscall,
dtrace -n 'syscall:::entry { @num[probefunc] = count(); }'
# Syscall count by process,
dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }'
# Read bytes by process,
dtrace -n 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'
# Write bytes by process,
dtrace -n 'sysinfo:::writech { @bytes[execname] = sum(arg0); }'
# Read size distribution by process,
dtrace -n 'sysinfo:::readch { @dist[execname] = quantize(arg0); }'
# Write size distribution by process,
dtrace -n 'sysinfo:::writech { @dist[execname] = quantize(arg0); }'
# Disk size by process,
dtrace -n 'io:::start { printf("%d %s %d",pid,execname,args[0]->b_bcount); }'
# Pages paged in by process,
dtrace -n 'vminfo:::pgpgin { @pg[execname] = sum(arg0); }'
# Minor faults by process,
dtrace -n 'vminfo:::as_fault { @mem[execname] = sum(arg0); }'
Find number of free blocks on a UFS filesystem
fstyp -v /dev/md/dsk/d0 | head -20

Cisco
Show what is connected to a switch
show int status | inc connected