Archive for Solaris

How to mirror ZFS root disk on a sparc system.

First we look to see that everything looks good on our current drive that we are booted off of.  I would also like to note that there is no UFS on this system at all.  We are booting entirely off of the ZFS pool rpool.

# zpool status
pool: rpool
state: ONLINE
scrub: none requested
config:

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

errors: No known data errors

Now verify that the two disks that you want to mirror looks the same at the slave level.

# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c0t0d0 <ST320011A cyl 38790 alt 2 hd 16 sec 63>
/pci@1f,0/ide@d/dad@0,0
1. c0t2d0 <DEFAULT cyl 38790 alt 2 hd 16 sec 63>
/pci@1f,0/ide@d/dad@2,0
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted, no defect list found]
/dev/dsk/c0t0d0s0 is part of active ZFS pool rpool. Please see zpool(1M).
/dev/dsk/c0t0d0s2 is part of active ZFS pool rpool. Please see zpool(1M).

FORMAT MENU:
disk       – select a disk
type       – select (define) a disk type
partition  – select (define) a partition table
current    – describe the current disk
format     – format and analyze the disk
repair     – repair a defective sector
show       – translate a disk address
label      – write label to the disk
analyze    – surface analysis
defect     – defect list management
backup     – search for backup labels
verify     – read and display labels
save       – save new disk/partition definitions
volname    – set 8-character volume name
!<cmd>     – execute <cmd>, then return
quit
format> ver

Primary label contents:

Volume name = <        >
ascii name  = <ST320011A cyl 38790 alt 2 hd 16 sec 63>
pcyl        = 38792
ncyl        = 38790
acyl        =    2
nhead       =   16
nsect       =   63
Part      Tag    Flag     Cylinders         Size            Blocks
0       root    wm       0 – 38789       18.64GB    (38790/0/0) 39100320
1 unassigned    wm       0                0         (0/0/0)            0
2     backup    wm       0 – 38789       18.64GB    (38790/0/0) 39100320
3 unassigned    wm       0                0         (0/0/0)            0
4 unassigned    wm       0                0         (0/0/0)            0
5 unassigned    wm       0                0         (0/0/0)            0
6 unassigned    wm       0                0         (0/0/0)            0
7 unassigned    wm       0                0         (0/0/0)            0

format> disk 1
selecting c0t2d0
[disk formatted, no defect list found]
format>

Notice that both disks have 0 – 38789 Cylinders.  So the disks look good, now we can attach the second disk.

# zpool attach rpool c0t0d0s0 c0t2d0s0
#
# zpool status
pool: rpool
state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scrub: resilver in progress for 0h0m, 3.28% done, 0h24m to go
config:

NAME          STATE     READ WRITE CKSUM
rpool         ONLINE       0     0     0
mirror      ONLINE       0     0     0
c0t0d0s0  ONLINE       0     0     0
c0t2d0s0  ONLINE       0     0     0

errors: No known data errors

WoW that was easy to mirror two disks with ZFS.  No need to set up data stores or anything like that.  The fact that the zpool status output specify “mirror” means the disks are mirrored and not striped.  If you have multiple zfs pools you can specify zpool status POOLNAME.

Now to try to distroy the disk, ha, ha, ha!

# dd if=/dev/random of=/dev/rdsk/c0t2d0s0
969+0 records in
969+0 records out

Now if that disk was on a normal RAID utility stuch as solstice disk suite SDS or even hardware raid then both disks would be destroyed because they operate at the block level, and will copy the random blocks back do c0t0d0s0

# zpool status
pool: rpool
state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using ‘zpool online’.
see: http://www.sun.com/msg/ZFS-8000-2Q
scrub: resilver in progress for 0h1m, 10.52% done, 0h12m to go
config:

NAME          STATE     READ WRITE CKSUM
rpool         DEGRADED     0     0     0
mirror      DEGRADED     0     0     0
c0t0d0s0  ONLINE       0     0     0
c0t2d0s0  UNAVAIL      0     0     0  cannot open

errors: No known data errors

Oha happy ZFS is already working on fixing or resilvering the disk that was written to with random data.

# zpool status
pool: rpool
state: DEGRADED
status: One or more devices could not be opened.  Sufficient replicas exist for
the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using ‘zpool online’.
see: http://www.sun.com/msg/ZFS-8000-2Q
scrub: resilver completed after 0h0m with 0 errors on Tue Apr 14 12:55:48 2009
config:

NAME          STATE     READ WRITE CKSUM
rpool         DEGRADED     0     0     0
mirror      DEGRADED     0     0     0
c0t0d0s0  ONLINE       0     0     0
c0t2d0s0  UNAVAIL      0     0     0  cannot open

errors: No known data errors

Now ZFS is angry because we wrote random data to the disk.

# zpool online  rpool  c0t2d0s0

# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0t2d0s0

Comments

Enable snmp on Solaris 10

So I had some trouble gettin snmp working. I edited /etc/snmp/conf/snmpd.conf with the proper trap and community for my enviroment.  Every time I tried to start snmp I would get erros.

checking /var/adm/messages

Nov  6 10:09:29 pressman2 /usr/lib/snmp/snmpdx: [ID 702911 daemon.error] can’t read the directory snmpd.conf [errno: Not a directory(20)]

me trying to start snmp

bash-3.00# svcadm enable svc:/application/management/snmpdx:default

bash-3.00# svcs|grep snmp
offline        10:03:20 svc:/application/management/snmpdx:default

On the second line you can see that I check and it was not started or offline.  So then it was time to consult with svcs -x.  That stated that I was missing a prerequisite process that snmp relied on.

bash-3.00# svcs -x
svc:/application/management/seaport:default (net-snmp SNMP daemon)
State: disabled since Wed Oct 28 16:25:27 2009
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: snmpd(1M)
Impact: 1 dependent service is not running.  (Use -v for list.)

bash-3.00# svcs |grep snmp
online         11:25:54 svc:/application/management/snmpdx:default

Now everything works like it should.

Comments

ssh: Connection closed by remote host

I was trying to ssh from one Sun Soalris server to another.

# ssh  remoteserver
ssh_exchange_identification: Connection closed by remote host
# ssh -v remoteserver
Sun_SSH_1.1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to mimi [10.20.55.222] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
debug1: Calling cleanup 0x34ae8(0×0)
#

Err it would not let me connect.  As you can see I first tried to ssh, then ssh in verbose mode.  As you can see the output did not really give anything that useful.

I logged into the remote server and all it would tell me is

Jul  7 11:37:53 remoteserver sshd[21761]: refused connect from clientserver

I wold have to be connected to the serial console to see this message, I was not able to see the message anywhere else.  Not in /var/adm/messages or /var/log/syslog

So what I ended up doing was adding this line to /etc/hosts.allow

p_ctminetd,sshd,bpcd,vnetd,vopied,bpjava-msvc: 10.20.55. : allow

That line allowed any host in the 10.20.55.* subnet to connect to the server now, and ssh was allowed to connect.

Comments

« Previous entries Next Page » Next Page »