Tech & Toys
-
Moving the /Users directory
Recently I needed to move the /Users tree onto another partition on a OS X machine at work, I found this great howto.
-
Mapping Between Logical and Physical Device Names on a Sun E450
If you need to find the slot that a disk is in from a given logical name (
c3t3d0
) you can follow this (Broken linkhttp://sunsolve.sun.com/search/document.do?assetkey=1-9-16735-1&searchclause=16735) document from sun. I’ve mirrored the important bits below incase it disapears- Determine the UNIX physical device name from the SCSI error message.
SCSI error messages are typically displayed in the system console and logged in the /usr/adm/messages file. ```
WARNING: /pci@6,4000/scsi@4,1/sd@3,0 (sd228) Error for Command: read(10) Error level: Retryable Requested Block: 3991014 Error Block: 3991269 Vendor: FUJITSU Serial Number: 9606005441 Sense Key: Media Error ASC: 0x11 (unrecovered read error), ASCQ: 0x0, FRU: 0x0
In the example SCSI error message above, the UNIX physical device name is `/pci@6,4000/scsi@4,1/sd@3`. * Determine the UNIX logical device name by listing the contents of the `/dev/rdsk` directory. Use the grep command to filter the output for any occurrence of the UNIX physical device name determined in Step 1: ``` % ls -l /dev/rdsk | grep /pci@6,4000/scsi@4,1/sd@3 lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s0 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:a,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s1 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:b,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s2 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:c,raw lrwxrwxrwx1 root root 45 Jan 30 09:07 c12t3d0s3 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:d,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s4 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:e,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s5 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:f,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s6 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:g,raw lrwxrwxrwx 1 root root 45 Jan 30 09:07 c12t3d0s7 -> ../../devices/pci@6,4000/scsi@4,1/sd@3,0:h,raw
The resulting output indicates the associated UNIX logical device name. In this example, the logical device name is `c12t3d0` * Determine the disk slot number using the `prtconf` command. Substitute the string disk@ for sd@ in the physical device name determined in Step 1. The result in this example is `/pci@6,4000/scsi@4,1/disk@3`. Use the grep command to find this name in the output of the prtconf command: ```
% prtconf -vp | grep /pci@6,4000/scsi@4,1/disk@3 slot#11: ‘/pci@6,4000/scsi@4,1/disk@3’
-
Daemontools run scripts collection
Found this nice collection of daemontools run scripts. Will find that useful someday
-
Partitioning >1Tb volumes
If you need to create partitions on a disk (or raid volume) which is larger than 1Tb you will need to use parted and set the disk label to
GPT
. This is an example session creating 2 1Tb partitions on a 2Tb raid5 volume:[root@sn-b03 parted]# parted /dev/sdb GNU Parted 1.6.9 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Using /dev/sdb Information: The operating system thinks the geometry on /dev/sdb is 291775/255/63. Therefore, cylinder 1024 ends at 8032.499M. (parted) mklabel gpt (parted) mkpart primary 0 1048576 (parted) mkpart primary 1048577 2097152 (parted) p Disk geometry for /dev/sdb: 0.000-2288754.000 megabytes Disk label type: gpt Minor Start End Filesystem Name Flags 1 0.017 -1048576.000 ext3 2 -1048575.000 0.000 (parted) quit Information: Don't forget to update /etc/fstab, if necessary. [root@sn-b03 parted]#
-
Where am I?
If you are writing a bash script and you need to know where you are you can use this:
#!/bin/sh # always prints out the directory in which this script is lives # no matter where it is run from # doesnt cope with ../bin/script.sh, which should be ./script.sh anyway bn=`basename $0`; echo $0 | grep "^/" > /dev/null 2>&1 if [ $? -eq 1 ]; then echo $0 | grep "^\.\/$bn" > /dev/null 2>&1 if [ $? -eq 1 ]; then echo case 1 - relative ref here=`dirname $PWD/$0 | sed 's/\.\///'` else echo case 2 - local ref here=$PWD fi else echo case 3 - root ref here=`dirname $0` fi echo script home is $here
Thanks to Justin for this
-
zaphod
Bits inside my pc…
-
Configuring mail clients to filter on a X-header
found this nice page which details how to configure various mail clients to filter on a given X-header. Uses for this would be to filter on the
X-Spam-Flag: YES
header that SpamAssassin adds to mail
-
CDROM sub folders empty when they shouldnt be
I was recently setting up a Jumpstart server and when I ran the setup_install_server script in Solaris_9/Tools I was getting:
ERROR: /cdrom/sol_9_sparc/s0/Solaris_9/Tools/Boot is not a valid install boot image<br /> Check that boot image is valid, or use [-t]<br /> to specify a valid boot image.
The solution is to restart the vold service which can be done with a simple:
# /etc/init.d/volmgt stop<br /> # /etc/init.d/volmgt start
Thanks to Nicholas for pointing this out to me.
-
Perl goodies
Found these two nice links this morning, first a very nice periodic table of perl operators and second, a useful little cgi that helps find out what is installed on your server.
-
300 most common english words
needed this for something I was working on, so though I would leave it here (Broken link
http://usefulthings.org.uk/files/common-english-words.txt)