Non-destructively grow a ufs file system

Solaris Admin No Comments

Today i had the need to rearrange my root disks in my Solaris work station. I really hadn’t put much thought into the initial layout and was starting to suffer for it. I moved slice5 out the way which left slice4 with the potential to expand by more than 100gb.

Part Tag Flag Cylinders Size Blocks
0 root wm 61305 - 65532 15.00GB (4228/0/0) 31456320
1 swap wu 0 - 563 2.00GB (564/0/0) 4196160
2 backup wm 0 - 65532 232.49GB (65533/0/0) 487565520
3 var wm 60177 - 61304 4.00GB (1128/0/0) 8392320
4 unassigned wm 571 - 14664 50.00GB (14094/0/0) 104859360
5 home wm 14665 - 28758 50.00GB (14094/0/0) 104859360
6 unassigned wm 46084 - 60176 50.00GB (14093/0/0) 104851920
7 unassigned wm 564 - 570 25.43MB (7/0/0) 52080

Do some work:

Part Tag Flag Cylinders Size Blocks
0 root wm 61305 - 65532 15.00GB (4228/0/0) 31456320
1 swap wu 0 - 563 2.00GB (564/0/0) 4196160
2 backup wm 0 - 65532 232.49GB (65533/0/0) 487565520
3 var wm 60177 - 61304 4.00GB (1128/0/0) 8392320
4 unassigned wm 571 - 46083 161.47GB (45513/0/0) 338616720
5 unassigned wm 0 0 (0/0/0) 0
6 home wm 46084 - 60176 50.00GB (14093/0/0) 104851920
7 unassigned wm 564 - 570 25.43MB (7/0/0) 52080

/dev/dsk/c1t1d0s4 51635799 23594933 27524509 47% /mnt

df -k shows the change is not registered, and that’s where the growfs command enters.  I will umount this file system as it is only a data slice, and on the broken part of the mirror.

heineken:/ # growfs /dev/rdsk/c1t1d0s4
Warning: 3696 sector(s) in last cylinder unallocated
/dev/rdsk/c1t1d0s4: 338616720 sectors in 55114 cylinders of 48 tracks, 128 sectors
165340.2MB in 3445 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
…………………………………………………………..
super-block backups for last 10 cylinder groups at:
337679776, 337778208, 337876640, 337975072, 338073504, 338171936, 338270368,
338368800, 338467232, 338565664

/dev/dsk/c1t1d0s4 166745210 23609269 141468489 15% /mnt

File systems are intact, no loss of data, no downtime. Of course this work was done on the broken mirror, in case of catastrophy my data would be intact on the other side. I will now commit this work to the other side and then mirror it back. As it is just a data slice this is possible - for root obviously downtime would be required. For that, you could look at Live Upgrade, which has more uses other than updating root safely. That will be for another time.

crontab -e does not allow editing of cron

Solaris Admin No Comments

I see this one a fair bit these days, so i thought i would write it up. On most machines when i edit crontab i get the following:

amstel:/ # crontab -e
320

And i have to CTRL-D to get out of it. Note that that 320 can be any number, doesn’t matter. The point is you cannot edit cron.

All you have to do is add this line;

EDITOR=/usr/bin/vi;export EDITOR

To /etc/profile or /.bashrc or /.bash_profile etc.

svccfg: couldn’t parse document

Solaris Admin No Comments

If you create your own smf manifests you undoubtedly have come across the “svccfg: couldn’t parse document” error. It indicates there is a fault in the xml file you are trying to parse. Unfortunately it does not provide any clues at all as to where the error lies.

Thankfully solaris also ships with the xmllint command:

# xmllint –valid ndd-nettune.xml
ndd-nettune.xml:2: I/O error : failed to load external entity “NULL”
<!DOCTYPE service_bundle SYSTEM “/usr/share/lib/xml/dtd/ service_bundle.dtd.1″>
^
ndd-nettune.xml:7: validity error : Validation failed: no DTD found !
<service_bundle type=’manifest’ name=’SUNWcsr:ndd’>
^
ndd-nettune.xml:47: parser error : Opening and ending tag mismatch: service line 9 and exec_method
</exec_method>
^
ndd-nettune.xml:75: parser error : Extra content at the end of the document
</service>

After the removal of redundant spaces and lines, and missing /> tags i tried again.

# svccfg validate ndd-nettune.xml
#

Alright, no unwanted error messages this time.

Editing /etc/power.conf

Solaris Admin No Comments

This weekend i moved my Sun boxes to the garage into a new Sun rack. Only one server was powered up and i found myself having to constantly go into the garage as there was no connectivity. I found the server was running but there was nothing on the console. I plugged a monitor in to find a login screen which was odd. I then plugged mouse and kb in and had to reboot after which it was fine, at least for a while. The next morning i again had lost connectivity. I went back to the garage and found the monitor black and no console output but the system was running. I rebooted again and again it looked like all was fine. I looked at the messages file which detail no issues. So i have been looking at the /etc/power.conf file.

anouk:/ # cat /etc/power.conf
# Copyright (c) 1996 - 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#pragma ident “@(#)power.conf 1.16 01/03/19 SMI”
#
# Power Management Configuration File
#
# This entry keeps removable media from being powered down unless the
# console framebuffer and monitor are powered down
# (See removable-media(9P))

device-dependency-property removable-media /dev/fb

autopm default
statefile //.CPR
# Auto-Shutdown Idle(min) Start/Finish(hh:mm) Behavior
autoshutdown 30 9:00 9:00 noshutdown

So this is not shutting anything down. I thought while i’m here let’s look at the options for this file. The reality of course is that you’re very unlikely to ever want to change this.

A system is considered idle with the following conditions: No mouse or keyboard activity, no tty characters are input, no disk activity and no nfs requests. In example 1 let’s change the idle conditions.

  autoshutdown          30              17:00 8:00                  default  

  ttychars                400
  diskreads               10
  nfsreqs                 5
  loadaverage             0.1

So now the system will be considered idle if no more than 400 characters are input or output. No more than 10 disk reads occur or 5 nfs requests. A 1 minute load average whilst idle is no more than 0.04 so in this case it is set to 0.1. The autoshutdown line means that shutdown will only occur after a system is idle for 30 minutes between 5pm and 8am.  The default behavior value depends upon the model.  For some it will mean auto shutdown and not for others.  So better to be specific.

autoshutdown            30              17:00 8:00               noshutdown

So with this setting the system will not shut down.  If you do make changes don’t forget to inform the power management framework with the new settings in the /etc/power.conf file.

anouk:/ # /usr/sbin/pmconfig

See also man pages for power.conf and the Solaris 10 sys admin guide.

« Previous Entries