Archive for March 18th, 2008
Zettabyte File System ZFS
Features:
1. 256 quadrillion zettabytes ( Terabytes, Petabytes, Exabytes, Zettabytes (1024 Exabytes))
2. RAID-0/1 & RAID-Z ( RAID-5 with enhancements ) ( 2 – required virtual devices )
3. Snapshots – read-only copies of file systems or volumes
4. Create volumes
5. Uses storage pools to manage storage – aggregates virtual devices
6. File systems attached to pools grow dinamically as storage is added
7. File systems may span multiple physical disk
8. ZFS is transactional (Similar to databases. Example: Writing 100 mb, but only 80mb is commited in a traditional file system, leaving 20 mb unwriting, and the data is corrupted, and in ZFS all is written or NONE.
9. Pools & file systems are auto-mounted. No need to maintain /etc/vfstab
10. Supports file system hierarchies: /pool1/{home(5GB),var(10GB), etc.}
11. Supports reservation of storage: /pool1(36GB)/{home(10GB),var(36–10GB)}
12. Provides a secure web-based management tool
*********** ZFS – CLI **************
# which zpool
/usr/sbin/zpool
zpool list – list known pools
zpool create pool_name(alphanumeric, _,-,:,.)
Pool Name Constraints
1. mirror
2. raidz
—— Pause: note to vmware —————————————————————-
Add a second disk to the image in vmware
In order to add second hard disk with Fusion.
- solaris must be halted.
- VM must be shut down.
- Click the + sign, add disk and enter a size.
- devfsadm (almost typed reboot — -r but that would be “old think” so that format sees the new device.)
format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
/pci@0,0/pci1000,30@10/sd@0,0
1. c1t1d0 <DEFAULT cyl 2557 alt 2 hd 128 sec 32>
/pci@0,0/pci1000,30@10/sd@1,0
———————————————————————————————————-
Continue….
zpool create pool_name device_name1, device_name2, device_name3, etc.
bash-3.00# devfsadm
bash-3.00# format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c0d1 <DEFAULT cyl 1303 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number): ^Z
[1]+ Stopped format
bash-3.00# zpool create pool1 c0d1
bash-3.00# echo $?
0
mount
/pool1 on pool1 read/write/setuid/devices/exec/xattr/atime/dev=2d50002 on Tue Mar 18 09:24:51 2008–
bash-3.00# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
pool1 9.94G 88K 9.94G 0% ONLINE -
ZFS Pool Statuses
1. ONLINE
2. DEGRADED (part of the mirror is broken or entire disk is fail, but still available)
3. FAULTED
4. OFFLINE
5. UNAVAILABLE
(Pools or datasets)
—————————-
zfs list – returns ZFS dataset info
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool1 85.5K 9.78G 25K /pool1
zfs mount – returns pools and mount points
bash-3.00# zfs mount
pool1 /pool1
zpool status – returns virtual devices that constitute pools
bash-3.00#zpool status
pool: pool1
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
pool1 ONLINE 0 0 0
c0d1 ONLINE 0 0 0
errors: No known data errors
bash-3.00#zpool status -v pool1
Note: ZFS requieres a minimum of 128MB virtual device to create a pool
(Recommendation render all the disks over zfs minus / )
var home should be separate disks for performance
——————-DESTROY ————————————————
zpool destroy pool1 – Destroys pool and associated file system
bash-3.00# zpool destroy pool1
bash-3.00# echo $?
0
—————-CREATE File systems within pool1 ———————
zfs create pool1/home – creates file system named ‘home’ in pool1
bash-3.00# zfs create pool1/home
bash-3.00# echo $?
0
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool1 114K 9.78G 25.5K /pool1
pool1/home 24.5K 9.78G 24.5K /pool1/home
Note: Default action of ‘zfs create pool1/home’ assigns all storage available to ‘pool1’, to ‘pool1/home’
##### Set quota on existing file system ######
zfs set quota=5G pool1/home
bash-3.00# zfs set quota=5G pool1/home
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool1 114K 9.78G 25.5K /pool1
pool1/home 24.5K 5.00G 24.5K /pool1/home
##### Create user-based file system beneath pool1/home #####
zfs create pool1/home/zivo
bash-3.00# zfs get -r quota pool1
NAME PROPERTY VALUE SOURCE
pool1 quota none default
pool1/home quota 5G local
pool1/home/pedrito quota none default
pool1/home/zivo quota none default
zfs get -r compression pool1
NAME PROPERTY VALUE SOURCE
pool1 compression off default
pool1/home compression off default
pool1/home/pedrito compression off default
pool1/home/zivo compression off default
############ Rename file systems ######################
bash-3.00# zfs rename pool1/home/zivo pool1/home/zivob
bash-3.00# echo $?
0
############ Extending dynamically, pool storage ######################
AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c0d1 <VMware V-0000000000000000-0001-10.00GB>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
2. c1d1 <DEFAULT cyl 4093 alt 2 hd 128 sec 32>
/pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
bash-3.00# zpool add pool1 c1d1
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool1 210K 17.6G 25.5K /pool1
pool1/home 76.5K 5.00G 27.5K /pool1/home
pool1/home/pedrito 24.5K 5.00G 24.5K /pool1/home/pedrito
pool1/home/zivokickass 24.5K 5.00G 24.5K /pool1/home/zivokickass
bash-3.00# zpool status
pool: pool1
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
pool1 ONLINE 0 0 0
c0d1 ONLINE 0 0 0
c1d1 ONLINE 0 0 0
errors: No known data errors
no hostkeys solaris 10 sshd
cat /var/svc/log/network-ssh\:default.log
Could not load host key: /etc/ssh/ssh_host_rsa_key Could not load host key: /etc/ssh/ssh_host_dsa_keycd /etc/sshssh-keygen -d -f ssh_host_dsa_key -N ""ssh-keygen -b 1024 -f ssh_host_rsa_key -t rsa -N ""
Solaris 10 HANDBOOK
Solaris 10
-
admintools is not implemented
-
pkgchk -P instead of grep /var/sadm/install/contents
-
RBAC: Role-Based access control (kind of built in sudo)
Solaris management commands
| smc | Starts the Solaris management console |
| smcront | Manage cron jobs |
| smdiskless | Manage diskless client support |
| smexec | Manage entries in the exec_attr database |
| smgroup | Manages group entries |
| smlog | Manages and views WBEN log files |
| smmultiuser | Manages bulk operations on multiples accounts |
| smosservice | Add OS services and diskless client support |
| smprofile | Manages profiles in the prof_attr and exec_attr db |
| smrole | Manages roles and users in role accounts |
| smserialport | Manages serial ports |
| smuser | Manages user entries |
how to Reboot / Halt / Poweroff
On Solaris using the shutdown command to reboot, halt or power off your server is the best option, because this command will call the rc script.
Reboot
shutdown -i6 -g60 -y
-i : init level
-g : grace time (60 secondes in this case)
-y : Pre-answer yes
Halt
shutdown -i0 -g60 -y
Power Off
shutdown -i5 -g60 -y
How to send a break on Solaris 10 x86
You will have to boot the system with “kadb”.
From the command line
# eeprom boot-file=kadb # reboot
OR
From the GRUB boot prompt choose edit and edit the second line
root (hd0,0,a) kernel /platform/i86pc/multiboot kadb module /platform/i86pc/boot_archive
Drop to kadb, generate a core file
From a directly attached keyboard or serial port connection, type:
F1-A - press the "F1" and "A" keys, simultaneously.
You can test it to make sure it’s work and then just enter:
:c
to return to the normal mode.
The control-alt-d key sequence also works.
Once at the kadb prompt, type:
$<systemdump
This will generate a core file, which can be retrieved from:
/var/crash/'uname -n' (or wherever the local system stores core files)
How to determine 32-bit or 64-bit?
How to determine whether a system has 32-bit or 64-bit solaris capablilities enabled
# isainfo -v 32-bit sparc applications
How to display the native instruction sets executable?
Isalist prints the names of the native instruction sets executable on this platform on the standard output
# isalist sparcv8 sparcv8-fsmuld sparcv7 sparc
How to displays information about processors?
# psrinfo -v
Status of processor 0 as of: 01/24/07 13:03:35
Processor has been on-line since 01/19/07 14:13:09.
The sparc processor operates at 60 MHz,
and has a sparc floating point processor.
How to find out if the the third processors is up?
if [ "`psrinfo -s 3 2> /dev/null`" -eq 1 ] then echo "processor 3 is up" fi
How to display solaris relase information?
# cat /etc/release
Solaris 8 10/00 s28s_u2wos_11b SPARC
Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
Assembled 31 August 2000
How to display a system’s installed memory?
# ptrconf System Configuration: Sun Microsystems sun4m Memory size: 128 Megabytes System Peripherals (Software Nodes): SUNW,SPARCstation-20 ...
Howto show machine and software revision information
# showrev Hostname: clust01 Hostid: 7235260f Release: 5.8 Kernel architecture: sun4m Application architecture: sparc Hardware provider: Sun_Microsystems Domain: Kernel version: SunOS 5.8 Generic 108528-03 August 2000
Howto show patched installed list
# showrev -p | more Patch: 109965-01 Obsoletes: Requires: Incompatibles: Packages: SUNWpamsc Patch: 109618-01 Obsoletes: Requires: Incompatibles: Packages: SUNWeuxwe, SUNWeuezt, SUNWeudlg, SUNWeudda Patch: 108725-02 Obsoletes: 109579-01 Requires: Incompatibles: Packages: SUNWcsu, SUNWcsr, SUNWhea Patch: 108825-01 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu Patch: 108875-07 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu, SUNWcsr, SUNWcsl, SUNWarc, SUNWcstl, SUNWhea Patch: 108899-01 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu Patch: 108982-05 Obsoletes: 109440-01 Requires: Incompatibles: Packages: SUNWcsu, SUNWhea Patch: 108985-02 Obsoletes: Requires: Incompatibles: Packages: SUNWcsu Patch: 109043-02 Obsoletes: Requires: 109041-01 Incompatibles: Packages: SUNWcsu Patch: 109045-02 Obsoletes: Requires: 109041-01 Incompatibles: Packages: SUNWcsu
How to display locales installed on a system (solaris 10)
# localeadm
How to determine if a local is installed on a system (solaris 10)
# localeadm -q
Display host id number
# hostid 723560f
How to display the user ownership of local UFS
# quot -a
/dev/rdsk/c0t1d0s0 (/):
834291 root
312013 bin
812 uucp
146 adm
91 lp
22 nobody
4 daemon
3 listen
/dev/rdsk/c1t1d0s0 (/opt):
538104 root
66742 bin
2168 #3792
/dev/rdsk/c0t1d0s7 (/export/home):
9 root
Howto configuring Telnet / FTP to login as root?
Now before getting into the details of how to configure Solaris for root logins, keep in mind that this is VERY BAD security. Make sure that you NEVER configure your production servers for this type of login.
Configure Telnet for root logins
Simply edit the file /etc/default/login and comment out the following line as follows:
# If CONSOLE is set, root can only login on that device. # Comment this line out to allow remote login by root. # # CONSOLE=/dev/console
Configure FTP for root logins
First remove the ‘root’ line from /etc/ftpusers.
Also, don’t forget to edit the file /etc/ftpaccess and comment out the ‘deny-uid’ and ‘deny-gid’ lines. If the file doesn’t exist, there is no need to create it.
NOTE: If you are using Solaris 9 or Solaris 10, the ftp* files are located in /etc/ftpd
How to setup timezone?
/etc/TIMEZONE
Howto setup nis client?
-
set the domain name
domainname nis.domaine.com
-
edit /etc/hosts
# # Internet host table # 127.0.0.1 localhost # NIS 192.168.1.100 nis1.domain.com 192.168.1.101 nis2.domain.com
-
ypinit
ypinit -c
pkgadd common mistake
In this example I’m trying to install the package “SUNWbash” but it could be any package, you may have been through those different cases:
# pkgadd SUNWbash pkgadd: ERROR: no packages were found in </var/spool/pkg> # pkgadd ./SUNWbash pkgadd: ERROR: no packages were found in </var/spool/pkg> # pkgadd /mnt/Solaris_10/Product/SUNWbash pkgadd: ERROR: no packages were found in </var/spool/pkg> # pkgadd -d ./SUNWbash pkgadd: ERROR: no packages were found in </mnt/Solaris_10/Product/SUNWbash>
In the three first cases “pkgadd” looks in the default folder “/var/spool/pkg” in order to find packages and install them but none is found. In the fourth case the package himself is defined as a folder containing packages, that’s why it fails.
The right solution is:
# pkgadd -d /mnt/Solaris_10/Product/ SUNWbash or # pkgadd -d $PWD SUNWbash
Thus pkgadd will consider “/mnt/Solaris_10/Product/” as default folder and “SUNWbash” as package to install.
Where is the packages folder
/var/sadm/pkg/
Package installed
/var/sadm/install/content
Which package owns an installed file
pkgchk -l -p /usr/bin/ls
If you cannot access your sun box, ssh/ftp/console whatever
Then try and issue a break from the console.
telnet> sent brk
Type 'go' to resume
{0} ok
{0} ok boot -s
Resetting ...
OBP Quick Memo
SEND A BREAK
From a telnet session:
ctrl+] send brk
From a ssh session:
~break
Quick memo
help (show categories) help sys (show sys help) printenv (varible name and status) setenv (to change) setenv auto-boot? true banner (show the mac address) prob-scsi-all (find all scsi devices, show number off harddrives) boot -s ( single user mode) boot cdrom -s (boot single user mode from the cdrom) boot net (boot network) boot net:dhcp - install (Boot install using jumpstart with DHCP) boot net - install (Boot install using jumpstart with Bootp) boot cdrom - install (Boot install using the cdrom) devalias (same as /etc/path_to_inst) devalias toto /sbus/SUNW,fdtwo show-devs (show all dev) show-nets (show net interface) set-default
From the running os:
eeprom
mount cdrom solaris core install : p
Unless you’ve changed the system’s configuration, mounting
CD/DVD media is supposed to happen automatically, with the
help of the “vold” daemon.
The CD/DVD will be mounted somewhere in /cdrom/xxxx with a
symbolic link /cdrom/cdrom0 pointing to the root directory of the
media.
If you’ve disabled “vold”, of if you didn’t install it, manual mounting
works like this:
1. iostat -En
This command can be used to print a list of SCSI/ATAPI/USB/
Firewire disk/cdrom/dvdrom devices. Note the disk id in front
of the entry, for example “c1t1d0″:
% iostat -En
c1t1d0 Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: HL-DT-ST Product: DVDRAM GMA-4020B Revision: A105 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 1 Predictive Failure Analysis: 0
2. Manually mount the device, using the device id from the above
iostat command, with slice “s2″ appended (on Solaris x86:
append “p0″).
# mount -F hsfs /dev/dsk/c1t1d0s2 /mnt
——SOLARIS X86–—-mount -F hsfs /dev/dsk/c1t0d0p0 /mnt