QuickTip: Solved How to reinitialize several disks with an empty SMI partition table


Hi folks!, first I want to thanks Arnaud Delanoue for commenting me about the script that implements the solution for the hardest part: labeling the disk automatically. I have come finally with the procedure to reset any disk from EFI to SMI. It’s commented in course ES-445 (Sun Cluster 3.2 Advanced Administration), so I recommend everyone to attend it and learn more about clustering best practices. Thanks again Arnaud.

Well, in my previous post we saw that we were able to reset any SMI labeled disk with a single command. Do you remember the command?

# echo "0 0 00 0 0" | fmthard -s - /dev/rdsk/c#t#d#s2

But we couldn’t change in a non-interactive way from EFI to SMI. Now with the help of a little bit of scripting we can solve this.

For each disk you want to reset to SMI with no partitions (only the backup partition) include this code in your little script.

if [ "`uname -p`" == "i386" ]
then
fdisk -B yourdisk
fi

This will remove your fdisk default partition table and will recreate a new partition with 100% of space assigned to SOLARIS2. This is an excerpt from the fdisk man page:

-B
Default to one Solaris partition that uses the whole
disk. On an x86 machine, if the disk is larger than 2 TB
(terabytes), the default size of the Solaris partition
will be limited to 2 TB.

But if the i386 disk was originally EFI labeled, it doesn’t change after fdisk. So we remain at the same point than before.

Now add these lines to your script:

format -e yourdisk <<-EOF
label
0
y
y
q
EOF

This will launch a non-interactive session of format in which we will relabel the disk. Great!!

Look the output of this code:
selecting c1t1d0
[disk formatted]

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
fdisk - run the fdisk program
repair - repair a defective sector
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
inquiry - show vendor, product and revision
scsi - independent SCSI mode selects
cache - enable, disable or query SCSI disk cache
volname - set 8-character volume name
! - execute , then return
quit
format> [0] SMI Label
[1] EFI Label
Specify Label type[0]: Ready to label disk, continue?
format> `y' is not expected.
format> #

So let's try it:

# zpool create z c1t1d0
# zpool destroy z
# fdisk c1t1d0

Total disk size is 9729 cylinders
Cylinder size is 16065 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 EFI 0 9729 9730 100

And now, let's change to SMI with fdisk -B:


# fdisk -B
# format -e yourdisk <<-EOF
>label
>0
>y
>y
>q
>EOF
selecting c1t1d0
[disk formatted]

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
fdisk - run the fdisk program
repair - repair a defective sector
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
inquiry - show vendor, product and revision
scsi - independent SCSI mode selects
cache - enable, disable or query SCSI disk cache
volname - set 8-character volume name
! - execute , then return
quit
format> [0] SMI Label
[1] EFI Label
Specify Label type[0]: Ready to label disk, continue?
format> `y' is not expected.
format>
#
# prtvtoc /dev/rdsk/c1t1d0s2
* /dev/rdsk/c1t1d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 255 tracks/cylinder
* 16065 sectors/cylinder
* 9728 cylinders
* 9726 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 16065 156232125 156248189
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
2 5 01 0 156248190 156248189
8 1 01 0 16065 16064

OK, It works!

VN:F [1.9.3_1094]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: +1 (from 1 vote)
QuickTip: Solved How to reinitialize several disks with an empty SMI partition table , 10.0 out of 10 based on 1 rating Sphere: Related Content

  • Facebook
  • Twitter
  • Google Buzz
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

Related posts:

  1. QuickTip: How to reinitialize several disks with an empty SMI partition table Hi, today i was preparing a couple of arrays of...

Related posts brought to you by Yet Another Related Posts Plugin.

, , , , , ,

  1. #1 by Arnaud on May 21, 2010 - 17:39

    You’re welcome!
    Nice post.

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
(will not be published)