Solaris: Cannot copy partition table (not aligned on cylinder boundary)

Written by - 0 comments

Published on - Listed in Solaris Hardware


In past articles I described, how defect hard drives can be replaced in a Solaris system (Replace hard drive in Solaris 10 on IBM x3650 with arcconf and zpool and Replace defect HDD with hpacucli and zpool). 

First I activated thew new drive in hpacucli by creating a raid0 logical drive from the physical drive:

=> controller slot=0 show config
[...]
   unassigned

      physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 300 GB, OK)

=> ctrl slot=0 create type=ld drives=2I:1:5 raid=0

=> controller slot=0 show config
[...]
   array E (SAS, Unused Space: 0 MB)

      logicaldrive 5 (279.4 GB, RAID 0, OK)

      physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 300 GB, OK)

The next step is to copy the partition table (which is stored in the slice 2) from an existing drive (c0t3d0) to the new one (c0t4d0) with the following command:

prtvtoc /dev/rdsk/c0t3d0s2 | fmthard -s - /dev/rdsk/c0t4d0s2

However this time I got an error:

Partition 0 not aligned on cylinder boundary: "       0      4    00        256 585855290 585855545"

I tried several things to solve this, including trying to reformat the disk, using fdisk a douzen times, tried to manually create a partition table (which doesn't seem possible)...
The partition table always seemed to be different on c0t4d0 than on c0t3d0.

Partition table for c0t4d0:

 Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0                0         (0/0/0)             0
  1 unassigned    wm       0                0         (0/0/0)             0
  2     backup    wu       0 - 36465      279.34GB    (36466/0/0) 585826290
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 unassigned    wm       0                0         (0/0/0)             0

Partition table for c0t3d0 (thats the table I want!):

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256      279.36GB          585855545   
  1 unassigned    wm                 0           0               0   
  2 unassigned    wm                 0           0               0   
  3 unassigned    wm                 0           0               0   
  4 unassigned    wm                 0           0               0   
  5 unassigned    wm                 0           0               0   
  6 unassigned    wm                 0           0               0   
  7 unassigned    wm                 0           0               0   
  8   reserved    wm         585855546        8.00MB          585871929

Nothing on the web could tell me the solution when I was looking for "Partition 0 not aligned on cylinder boundary". Until I searched for "solaris delete partition" where I came across an artictle from 2008: Delete ZFS slices from a disk. Although this isn't what I tried to do in the first place, the article gave me an important information about the different disk labels in Solaris:

It turned out that the disk was labeled with EFI type, and hasn’t a slice2, but has a slice8, and so the mirror won’t be recreated.

Format could not handle that disk, we could not delete slice 8 because ‘8 is not expected’...
After a bit of googling we found the stuff about EFI Vs. VTOC labels.

I verified the label on the existing drive and it was confirmed, it had an EFI label on it. So I needed to relabel the drive to EFI in format:

format -e c0t4d0
format> l
[0] SMI Label
[1] EFI Label
Specify Label type[0]: 1
Warning: This disk has an SMI label. Changing to EFI label will erase all current partitions.
Continue? yes

I verified the partition table and now finally c0t4d0 and c0t3d0 looked the same! 

Now a simple zfs replace and the resilvering started:

zpool replace datapool c0t4d0

To summarize: The disk label is ridiculously important on Solaris. Even when I tried to manually create a partition and label this partition as EFI, this did not change the partition table. Only after having changed the label, the partition table changed and the drive was finally ready to be replaced in the pool!


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder