Showing posts with label Manage/configure. Show all posts
Showing posts with label Manage/configure. Show all posts

Saturday, June 26, 2010

zdb command

Typing “zdb” with no arguments produces a list of pools and the storage devices they are using. Its a quick way to find out the serial number of a drive in a zpool

Saturday, October 3, 2009

Remote powerdown from Windows with plink.exe

Because I am using a private network without connection to the outside world,
I am not concerned about security.
Usink plink.exe as part of the puTTY package I managed a remote shutdown:
Create a shortcut on windows with the following command:
(I use the user admin for logon)

plink.exe -ssh admin@hostname -pw password -m shutdown

The tricky bit is the remote command with the option -m,
(you have to use the full path because no profile is loaded)
so my "shutdown" saved on the windows box contains this line:

/usr/bin/pfexec /usr/sbin/init 5

very similar to the 'pfexec init 5' you use when logged on in Solaris

Sunday, September 6, 2009

Boot sequence with IDE and SATA Disk

Originally set in bios boot section to boot from sata disk. I had my IDE disk which was originally my boot device disconnected.

I want to mirror my boot disk so use both IDE and SATA disk when I connected the power again and tried to boot up It didn’t wanted to boot. Although it still sees my SATA disk as first boot device It apparently wants to boot from IDE no matter what.

In order to boot from SATA and having the IDE disk powered and connected It was mentioned I should disable the device in the main menu where it was recognized by BIOS auto detection. I changed the value into Not installed.

That did the trick, If I do a format the disk is seen by Solaris. So now I can setup the disk as mirror for my boot drive.

Monday, August 31, 2009

iostat -En

An example of the above command:
# iostat -En
c8d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: ST3160215AS Revision: Serial No: 6RA Size: 160.04GB <160039305216 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c7t0d0 Soft Errors: 0 Hard Errors: 9 Transport Errors: 0
Vendor: PLEXTOR Product: DVDR PX-712A Revision: 1.09 Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 9 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
c10t0d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: WDC WD40 Product: 0LB-07DNA2 Revision: 7B79 Serial No:
Size: 40.02GB <40020664320 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 76 Predictive Failure Analysis: 0

Saturday, August 29, 2009

Installing Logwatch on OpenSolaris

source: Caffeinated
Typically, installing Logwatch is fairly trivial. On Linux, you’d just use the package installer command and you’re done. On OpenSolaris, there doesn’t seem to be a packaged version of Logwatch (yet), so installing from the source tarball is necessary. Fortunately, there’s a shell script that performs the installation. The bad news is this script finds /usr/sbin/install which is the Solaris version of install. This version behaves very differently from those found in other Unix variants. The Logwatch installer is expecting the behavior of the install script found on Linux, so it fails miserably on OpenSolaris.

The good news is, there’s a simple solution. Just install the SUNWscp package. This is the “source compatibility package”, which installs numerous commands that help OpenSolaris behave more like other Unix systems. The Logwatch installer script prepends the /usr/ucb directory to the PATH when it runs, so it finds the install script that it is expecting, and thus it installs Logwatch perfectly. The only thing left is to add the crontab entry, as shown at the end of the install output.

One last note about Logwatch, and it concerns that crontab entry. It seems that the default configuration for Logwatch is to print the report rather than sending an email to the default recipient, root. However, the example crontab entry is redirecting all output to /dev/null. So how exactly is one supposed to get a daily report? The answer is to edit the /etc/logwatch/conf/logwatch.conf file, adding Print = no at the end of the file. That tells Logwatch to email the report rather than printing. It’s a mystery to me why that’s the default given the example crontab entry they display during the installation process. But at least it’s easy to fix, and nicely demonstrates how easy it is to customize Logwatch without touching the default configuration files.

Sunday, August 16, 2009

Get serial number of disk using smartmontools

(source: http://cafenate.wordpress.com/2009/02/22/setting-up-smartmontools-on-opensolaris/)
Installed smartmontools 5.38:
tar zxvf smartmontools-5.38.tar.gz
cd smartmontools-5.38
./configure
make
make install
(Smartmontools is by default installed in /usr/local)

The first change to make in /usr/local/etc/smartd.conf is to comment out the DEVICESCAN line, which is fine if you want to scan all disks in your system, but I found that smartmontools didn’t like my rpool disk, and it wanted me to declare the disk types as “scsi” for it to do anything at all. Next we have to tell smartd which disks to monitor, so I added the following lines to the end of the smartd.conf file:

/dev/rdsk/c8t0d0 -d scsi -H -m redalert
/dev/rdsk/c8t1d0 -d scsi -H -m redalert
/dev/rdsk/c8t2d0 -d scsi -H -m redalert
/dev/rdsk/c8t3d0 -d scsi -H -m redalert
/dev/rdsk/c8t4d0s0 -d scsi -H -m redalert


goto /usr/local/sbin

root@dawbckup:/usr/local/sbin# ./smartctl -d scsi -a /dev/rdsk/c7t0d0
smartctl version 5.38 [i386-pc-solaris2.11] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Serial number: S13PJDWS647014
Device type: disk
Local Time is: Sun Aug 16 15:11:29 2009 WEST
Device supports SMART and is Enabled
Temperature Warning Disabled or Not Supported
SMART Health Status: OK

Current Drive Temperature: 31 C

Error Counter logging not supported
No self-tests have been logged
root@dawbckup:/usr/local/sbin

c8t0d0: S13PJDWS647014
c8t1d0: S13PJDWS304477
c8t2d0: S13PJDWS647020
c8t3d0: S13PJDWS304478
(the disks of my SAN)

So far so good, but what about having smartd run at bootup, and continuously monitoring the disk status? In Linux, you’d use initd, but since this is OpenSolaris, we’ll use the Service Management Framework (SMF) instead. To do that, paste the following text into /var/svc/manifest/site/smartd.xml, change the file ownership to root:sys, and invoke:
pfexec svccfg -v import /var/svc/manifest/site/smartd.xml
Then check that the service is running (svcs smartd), and if not, enable it using pfexec svcadm enable smartd.

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="smartd">
  <service
     name="site/smartd"
     type="service"
     version="1">
    <single_instance/>
    <dependency
       name="filesystem-local"
       grouping="require_all"
       restart_on="none"
       type="service">
      <service_fmri value="svc:/system/filesystem/local:default"/>
    </dependency>
    <exec_method
       type="method"
       name="start"
       exec="/usr/local/etc/rc.d/init.d/smartd start"
       timeout_seconds="60">
      <method_context>
        <method_credential user="root" group="root"/>
      </method_context>
    </exec_method>
    <exec_method
       type="method"
       name="stop"
       exec="/usr/local/etc/rc.d/init.d/smartd stop"
       timeout_seconds="60">
    </exec_method>
    <instance name="default" enabled="true"/>
    <stability value="Unstable"/>
    <template>
      <common_name>
        <loctext xml:lang="C">
          SMART monitoring service (smartd)
        </loctext>
      </common_name>
      <documentation>
        <manpage title="smartd" section="1M" manpath="/usr/local/share/man"/>
      </documentation>
    </template>
  </service>
</service_bundle>

A this point we have a managed service that is checking the health of our disks, and if anything comes up, it will send an email to the redalert user.

Saturday, August 15, 2009

iostat command

iostat -xnzc 1

us sy wt id
1 7 0 92
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 348.0 0.0 6340.0 0.0 0.1 0.1 0.2 3 5 c7t0d0
0.0 348.0 0.0 6340.0 0.0 0.1 0.1 0.2 3 5 c7t1d0
0.0 347.0 0.0 6340.0 0.0 0.1 0.1 0.2 3 5 c7t2d0

iostat -xtc 2 2

extended device statistics tty cpu
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout us sy wt id
cmdk0 2.6 0.8 134.4 13.7 0.1 0.0 32.7 1 3 0 97 1 1 0 99
fd0 0.0 0.0 0.0 0.0 0.0 0.0 981.3 0 1
sd0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd3 0.1 21.1 1.8 369.1 0.0 0.0 0.5 0 0
sd4 0.1 21.1 1.8 369.1 0.0 0.0 0.4 0 0
sd5 0.1 21.1 1.8 369.1 0.0 0.0 0.4 0 0
sd6 0.1 0.0 1.3 0.3 0.0 0.0 0.9 0 0
extended device statistics tty cpu
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout us sy wt id
cmdk0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 309 0 0 0 100
fd0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0


zpool iostat 3

capacity operations bandwidth
pool used avail read write read write
---------- ----- ----- ----- ----- ----- -----
dawpool 2.78G 2.72T 0 16 3 771K
rpool 7.79G 12.2G 2 0 137K 14.0K
---------- ----- ----- ----- ----- ----- -----
dawpool 2.78G 2.72T 0 0 0 0
rpool 7.79G 12.2G 0 0 0 0

ZFS Management Console WEBMIN

ZFS Web-Based Management

A web-based ZFS management tool is available to perform many administrative actions. With this tool, you can perform the following tasks:

* Create a new storage pool.
* Add capacity to an existing pool.
* Move (export) a storage pool to another system.
* Import a previously exported storage pool to make it available on another system.
* View information about storage pools.
* Create a file system.
* Create a volume.
* Take a snapshot of a file system or a volume.
* Roll back a file system to a previous snapshot.

==============================================
Note: this is what I found regarding Webmin on opensolaris:

1. Install the Sun Webmin package by running - pkg install SUNWwebmin
2. Go to /usr/sfw/lib/webmin and run ./setup.sh
3. Edited /etc/webmin/miniserv.users and added my primary user as follows:
admin:x:101
-This allows you to login to the server
4. Change password for webmin account admin
(At running setup I was not asked to provide a userID/password, so login failed)
To set/change/update password for the user created in step 3:

#cd /usr/sfw/lib/webmin
# ./changepass.pl admin
usage: changepass.pl

This program allows you to change the password of a user in the Webmin
password file. For example, to change the password of the admin user
to foo, you would run:
changepass.pl /etc/webmin admin foo
This assumes that /etc/webmin is the Webmin configuration directory.

5. Edited /etc/webmin/webmin.acl using a copy of the existing entry for root and added a new line and changed root to admin to give access to all the modules
6. Restart webmin using svcadm restart webmin
7. You can now access the WebMin interface at http://:10000/

Friday, August 14, 2009

SATA Mode set to AHCI

Setup raidZ with AHCI SATA

Updated Asus Bios to 1102 using Alt-F2 during boot (updated Bios file was loaded onto my USB stick). Bios successfully updated.
At first boot after bios update I went into Bios setup and configured in bios SATA Mode to AHCI (was SATA)
After second boot up I destroyed dawpool and did a format to recognize the disks again:


root@dawbckup:~# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0d1
/pci@0,0/pci-ide@6/ide@0/cmdk@1,0
1. c7t0d0
/pci@0,0/pci1043,82e2@9/disk@0,0
2. c7t1d0
/pci@0,0/pci1043,82e2@9/disk@1,0
3. c7t2d0
/pci@0,0/pci1043,82e2@9/disk@2,0
4. c7t3d0
/pci@0,0/pci1043,82e2@9/disk@3,0
Specify disk (enter its number): ^C
root@dawbckup:~#

zpool create dawpool raidz c7t0d0 c7t1d0 c7t2d0 spare c7t3d0

root@dawbckup:~# zpool create dawpool raidz c7t0d0 c7t1d0 c7t2d0 spare c7t3d0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c7t0d0s0 is part of exported or potentially active ZFS pool dawpool. Please see zpool(1M).
root@dawbckup:~# zpool create -f dawpool raidz c7t0d0 c7t1d0 c7t2d0 spare c7t3d0
root@dawbckup:~#


root@dawbckup:~# zpool status
pool: dawpool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
dawpool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
c7t0d0 ONLINE 0 0 0
c7t1d0 ONLINE 0 0 0
c7t2d0 ONLINE 0 0 0
spares
c7t3d0 AVAIL

errors: No known data errors

pool: rpool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c0d1s0 ONLINE 0 0 0

errors: No known data errors
root@dawbckup:~#

Wednesday, August 12, 2009

install package from commandline (gcc compiler)

root@dawbckup:/usr/sbin# which gcc
no gcc in /usr/sbin /usr/bin
root@dawbckup:/usr/sbin# pfexec pkg install gcc-dev
DOWNLOAD PKGS FILES XFER (MB)
Completed 20/20 3095/3095 37.97/37.97

PHASE ACTIONS
Install Phase 3932/3932
PHASE ITEMS
Reading Existing Index 8/8
Indexing Packages 20/20
root@dawbckup:/usr/sbin#

Wednesday, May 20, 2009

Import existing array to new server

After a POC (Proof of Concept) with openSolaris on an old Dell GX270 with a zfs pool "daw" I wanted to know how to link that existing pool to my new Config based on M4N78-PRO setup:

admin@dawbckup:~# zpool import daw
cannot import 'daw': pool may be in use from other system, it was last accessed by dawbkup (hostid: 0xc9e4de) on Wed May 6 16:02:36 2009
use '-f' to import anyway
admin@dawbckup:~# zpool import -f daw
cannot share 'daw/backup': iscsitgtd failed request to share
zfs set shareiscsi=on daw/backup
admin@dawbckup:/etc# iscsitadm list target -v
Target: daw/backup
iSCSI Name: iqn.1986-03.com.sun:02:aa46a269-bef7-4432-9ed2-9890738fc784
Alias: daw/backup
Connections: 0
---

Voila here it is back again. Now I can mount it again in windows and we're back in business.

admin@dawbckup:~# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
daw 149G 5.29G 144G 3% ONLINE -
rpool 20G 6.60G 13.4G 33% ONLINE -

admin@dawbckup:/etc# zfs list
NAME USED AVAIL REFER MOUNTPOINT
daw 120G 26.7G 18K /daw
daw/backup 120G 141G 5.29G -
rpool 8.89G 10.8G 78K /rpool
rpool/ROOT 4.99G 10.8G 18K legacy

Add ISCSI package

After the update to the latest version:
admin@dawbckup:/etc# uname -a
SunOS dawbckup 5.11 snv_111a i86pc i386 i86pc

You have to select from the Category "Storage" the package "storage-nas"
Without it I could not run the command: iscsitadm list target -v

update to the latest OpenSolaris (save Boot Environment)

Before you update make a backup of your BE:
#save BOOT Environment
beadm create (type the name for this backup here)

Add dev to the package manager environment to get the latest updates:
http://pkg.opensolaris.org/dev
run package manager from the menu and choose update all (555 packages in my case)
If you get an error that it cannot install them, you probably forgot to check the radiobutton to set dev as Preferred Repository

Update to specific build:
So, can anybody advise how the system can be upgraded to chosen dev version?

Ok, here is the procedure:

Starting from OpenSolaris 2009.06 (snv_111b) active BE.

1) beadm create snv_111b-dev
2) beadm activate snv_111b-dev
3) reboot
4) pkg set-authority -O http://pkg.opensolaris.org/dev opensolaris.org
5) pkg install SUNWipkg
6) pkg list 'entire*'
7) beadm create snv_118
8) beadm mount snv_118 /mnt
9) pkg -R /mnt refresh
10) pkg -R /mnt install entire@0.5.11-0.118
11) bootadm update-archive -R /mnt
12) beadm umount snv_118
13) beadm activate snv_118
14) reboot

Now you have a snv_118 development environment.

You need a jump-off BE that has a lower build then the one you want to install.

OpenSolaris - slow boot fix

If you've installed opensolaris 11/08 and unhappily found it's slow as mud to boot..

# edit /rpool/boot/grub/menu.lst
# look for the lines like.. below and remove them..

splashimage /boot/solaris.xpm
foreground d25f00
background 115d93

# next find the kernel line and change from
--kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=graphics
++kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS

My boot time went from longer than 5 minutes to under 30 seconds. and you get to see the svc errors :)