Automatic disk labeling


 
Thread Tools Search this Thread
Operating Systems Solaris Automatic disk labeling
# 1  
Old 09-25-2006
Automatic disk labeling

First post Smilie ...
Here is a script for automatic labeling of previously unlabeled disks.
Other methods exist (format -f cmd_file), but I like this because it's all in one place.
Code:
#!/bin/ksh
#----------------------
# format_label
# Automatic labeling of previously unlabeled disks
# 2006.08.31 ken.wachtler
#----------------------
 
# Enter a list of disks, as format's banner would report them
Disks="
c4t50060482CCAB2987d27
c4t50060482CCAB2987d28
c4t50060482CCAB2987d29
c4t50060482CCAB2987d30
c4t50060482CCAB2987d31
c4t50060482CCAB2987d32
c4t50060482CCAB2987d33
c4t50060482CCAB2987d34
c4t50060482CCAB2987d35
c4t50060482CCAB2987d36
c4t50060482CCAB2987d37
c4t50060482CCAB2987d38
c4t50060482CCAB2987d39
c4t50060482CCAB2987d40
c4t50060482CCAB2987d41
c4t50060482CCAB2987d42
c4t50060482CCAB2987d43
c4t50060482CCAB2987d44
c4t50060482CCAB2987d45
c4t50060482CCAB2987d46
c4t50060482CCAB2987d47
c4t50060482CCAB2987d48
c4t50060482CCAB2987d49
c4t50060482CCAB2987d50
c4t50060482CCAB2987d51
c4t50060482CCAB2987d52
c4t50060482CCAB2987d53
c4t50060482CCAB2987d54
c4t50060482CCAB2987d55
c4t50060482CCAB2987d56
c4t50060482CCAB2987d57
c4t50060482CCAB2987d58
c4t50060482CCAB2987d59
c4t50060482CCAB2987d60
c4t50060482CCAB2987d61
c4t50060482CCAB2987d62
"
 
for d in $Disks ; do
 
  # write label
  printf "label\nyes\nquit\n" | format -d $d
 
  # check label
  printf "\n\n${d}\n\n"
  prtvtoc /dev/dsk/${d}s0 | egrep '^P  |^  '
  echo "<cr> to cont: "
  read a
 
done


Last edited by blowtorch; 09-25-2006 at 11:19 PM.. Reason: to add code tags
# 2  
Old 09-25-2006
Hi kwachtler,
Thanks for sharing the code. I have just one suggestion, when you do post any code, please wrap that inside code tags. First put in [ code ], then your code, and then [ /code ]. Remove the spaces in the [] brackets though.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Solaris

EFI disk labeling / understand the parition table / sectors not continue

Hi all, I have a EFI disk and it is use in zfs pool. partition> p Volume: rpool Current partition table (original): Total disk sectors available: 1172107117 + 16384 (reserved sectors) Part Tag Flag First Sector Size Last Sector 0 usr wm ... (8 Replies)
Discussion started by: javanoob
8 Replies

2. Shell Programming and Scripting

PHP Labeling/Punctuation Syntax Question

Greetings! My first PHP question; and, no doubt, a "no-brainer" for the initiated :) The question centers around the proper syntax for input field labeling. The snippet which puzzles me (and the candidate which I wish to modify) goes like this:<?php _e('Hello World'); ?>:<br />What I'd like... (0 Replies)
Discussion started by: LinQ
0 Replies

3. Solaris

Labeling VTOC

How to relabeling the disk VTOC if i relabel the disk the previous data is available or not (5 Replies)
Discussion started by: chandu.bezawada
5 Replies

4. UNIX for Dummies Questions & Answers

Numerical Labeling using sed

Hi, I have been working on this problem, but could only get so far. I have a file that looks like this (cat,chimp,(((dog,cat,cow),orangutan),((horse,((cat,dog),(cow,pig))),cat,mouse,rat))); I would like after each instance of the word 'cat' to have an incrementing numerical label. I... (5 Replies)
Discussion started by: cavanac2
5 Replies

5. Filesystems, Disks and Memory

Automatic monitor disk-space

Hello, I am trying to find a shell script to monitor diskspace of all the directories in the server. When the script encounteres a disk which above the treashold, I want an email notification. My system runs on AIX. Is there anybody around who can help me with such a script? ... (3 Replies)
Discussion started by: anuradha
3 Replies

6. Shell Programming and Scripting

Automatic monitor disk-space

Hello, I am trying to find a shell script to monitor diskspace. When the script encounteres a disk which above the treashold, I want an email notification. My system runs on a Sun Solaris. Is there anybode around who can help me with such a script? Norbert (3 Replies)
Discussion started by: nfbeerse
3 Replies
Login or Register to Ask a Question