Sponsored Content
Full Discussion: Automatic disk labeling
Operating Systems Solaris Automatic disk labeling Post 302090410 by kwachtler on Monday 25th of September 2006 12:17:12 PM
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
 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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
diskscan(1M)						  System Administration Commands					      diskscan(1M)

NAME
diskscan - perform surface analysis SYNOPSIS
diskscan [-W] [-n] [-y] raw_device DESCRIPTION
diskscan is used by the system administrator to perform surface analysis on a portion of a hard disk. The disk portion may be a raw parti- tion or slice; it is identified using its raw device name. By default, the specified portion of the disk is read (non-destructive) and errors reported on standard error. In addition, a progress report is printed on standard out. The list of bad blocks should be saved in a file and later fed into addbadsec(1M), which will remap them. OPTIONS
The following options are supported: -n Causes diskscan to suppress linefeeds when printing progress information on standard out. -W Causes diskscan to perform write and read surface analysis. This type of surface analysis is destructive and should be invoked with caution. -y Causes diskscan to suppress the warning regarding destruction of existing data that is issued when -W is used. OPERANDS
The following operands are supported: raw_device The address of the disk drive (see FILES). FILES
The raw device should be /dev/rdsk/c?[t?]d?[ps]?. See disks(1M) for an explanation of SCSI and IDE device naming conventions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |x86 | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
addbadsec(1M), disks(1M), fdisk(1M), fmthard(1M), format(1M), attributes(5) NOTES
The format(1M) utility is available to format, label, analyze, and repair SCSI disks. This utility is included with the diskscan, addbad- sec(1M), fdisk(1M), and fmthard(1M) commands available for x86. To format an IDE disk, use the DOS format utility; however, to label, ana- lyze, or repair IDE disks on x86 systems, use the Solaris format(1M) utility. SunOS 5.10 24 Feb 1998 diskscan(1M)
All times are GMT -4. The time now is 06:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy