Hardware & MacOSX & Unix & VFX 24 Jan 2008 05:05 pm

Read the man page, dude (Xsan Xserve RAID example)

Hard drives

Our Goal: We want to erase a hard drive that was formerly part of Xsan (in an Xserve RAID). We’ve placed the ATA drive in external enclosure, then connected to a workstation with Xsan software, but not attached to Xsan volume (for safety).

The Problem: Disk Utility won’t erase the drive.

Known Solution: Erase the Xsan label, and then erase the drive afterwards.


1. List all Xsan labeled devices, so we can remove the label:

ilovelog:~ blog$ cvlabel -l
Insufficient administrative privileges.

ilovelog:~ blog$ sudo !!
sudo cvlabel -l

Hmm, nada, nothing shows up. Strange!

2. Use disk Utility to list available drives

ilovelog:~ blog$ diskutil list
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *152.7 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_HFS nobody 152.5 GB disk0s3
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *149.1 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_Driver43 28.0 KB disk1s2
3: Apple_Driver43 28.0 KB disk1s3
4: Apple_Driver_ATA 28.0 KB disk1s4
5: Apple_Driver_ATA 28.0 KB disk1s5
6: Apple_FWDriver 256.0 KB disk1s6
7: Apple_Driver_IOKit 256.0 KB disk1s7
8: Apple_Patches 256.0 KB disk1s8
9: Apple_HFS someone 149.0 GB disk1s9
/dev/disk2
#: type name size identifier
0: Apple_Xsan_Component *233.8 GB disk2

The internal hard drive and the former Xsan drive show up.

3. The drive exists, so let’s try to erase it.

ilovelog:~ blog$ sudo diskutil eraseDisk HFS test /dev/disk2

diskutil won’t let us erase it.

4. Invoking cvlabel without arguments shows us man page. Let’s see what we’re doing wrong.

ilovelog:~ blog$ sudo cvlabel
Usage: cvlabel -l [-s] [-v] [-a]
cvlabel -L [-v] [-a]
cvlabel -c
cvlabel -x [-a]
cvlabel [-v] [-f] [-q ] [-r] [-e]
cvlabel [-f] -u
cvlabel -D
where:
-l List disks. (Not invasive.)
-L List disks in Long format.
-x List disks in Property List format.
-s Display the disk serial number if available.
-a Display all disks, even unusable ones.
-v Verbose output enabled.
Note: specifying -v multiple times increases verbosity.
-c Outputs a cvlabel format template file to stdout.
-e Changes the default label type for 1-2TB LUNs from VTOC
to EFI.
-f Forces immediate operation without confirmation.
WARNING: care should be taken when using the -f option
since data loss may result if an incorrect
is specified when labeling.
-q Set the Irix ctq_depth value in the label. Default=16.
-r Relabel disks, even if they already have valid labels.
-u Unlabel a volume.
-D Dump the label to stdout in ascii.
A file containing “ ” entries for
each disk to label.
A number in the range 0-254.
The name of a volume. For example, “CvfsDisk0″

5. Aha! There’s an option to show all disks, even “unusable ones”. Let’s try that.

ilovelog:~ blog$ sudo cvlabel -la
/dev/rdisk2 [Hitachi HDS722525VLAT80 ] acfs “wee” Sectors: 2935876352. SectorSize: 512. Maximum sectors: 490091377. [Unusable: Unable to read last data block]

ilovelog:~ blog$ sudo cvlabel -u “wee”

*WARNING* This program will remove the volume label from the
device specified (wee).

After execution, the devices will not be usable by the
Xsan. You will have to relabel the
device to use it on the Xsan.

Do you want to proceed? (Y / N) -> y

6. It worked. We found the label, which we then removed. Running cvlabel again shows no label.

ilovelog:~ blog$ sudo cvlabel -la
/dev/rdisk2 [Hitachi HDS722525VLAT80 ] unknown Sectors: 490091377. SectorSize: 512.
ilovelog:~ blog$ sudo diskutil eraseDisk HFS test rdisk2
Could not find the disk rdisk2
ilovelog:~ blog$ sudo diskutil eraseDisk HFS test disk2
Started erase on disk disk2

Creating Partition Map 100% ..
Finished erase on disk disk2

Finished partitioning on disk disk2

7. Now let’s erase the disk

sudo diskutil eraseDisk HFS test /dev/disk2

8. Partition the disk. Don’t worry about the exact size of second (or last) volume, it will auto-magically allocate it.

diskutil partitionDisk disk2 2 HFS+ Untitled 90G MS-DOS DOS 60G

Leopard & MacOSX & Tiger & Windows 20 Nov 2007 12:22 pm

Cloning Intel Mac workstations

Leopard & MacOSX & log 08 Nov 2007 05:15 pm

10.5 Update: Syslog + Tail

Leopard & MacOSX 08 Nov 2007 08:36 am

Mac OS X 10.5 - Directory Services Changes

MacOSX & Tiger & Windows 06 Aug 2007 07:30 pm

Troubleshooting Directory Services

Linux & MacOSX & Software & Tiger & Windows 05 Aug 2007 05:49 pm

Directory Access