bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possibly Broken GPT from Solaris


From: Jim Meyering
Subject: Re: Possibly Broken GPT from Solaris
Date: Sat, 21 Jan 2012 09:37:37 +0100

Richard Laager wrote:
> Do you have any thoughts on this?
> http://groups.google.com/a/zfsonlinux.org/group/zfs-devel/browse_thread/thread/04a5b2a71114f66e
>
> You can download a compressed sample disk image of a newly created
> whole-disk zpool from Solaris here:
> http://coderich.net/solaris-data.img.tgz
>
> It's 100 MB disk image, but as a sparse file only takes up about 3 MB.
> Compressed, it's 144 KB.
>
> Is the GPT table really broken, or is this a bug in parted? If it's
> really broken, is this something worth working around so people don't
> accidentally destroy their partition tables?

Thanks for the report.
I fixed parted to handle precisely the case of zfs-related GPT tables.
Here's the NEWS entry for that change:

    libparted can now read partition tables with a number of partition
    array entries that is different from the default of 128.  Before,
    it would fail to recognize them and could even read beyond the end
    of a heap-allocated buffer.

Here's the commit:

    gpt: don't misbehave with e.g., a 9-entry partition array
    http://git.sv.gnu.org/cgit/parted.git/commit/?id=ce85c5145ed5e267e

There hasn't been a release since that change, so if you want to
try it before parted-3.1, you'll have to build from git.

Using the latest built from git against your image, I get this:

  $ ./parted -s /t/solaris-data.img u s p
  Error: The backup GPT table is not at the end of the disk, as it should be.  
This might mean that another operating system believes the disk is smaller.  
Fix, by moving the backup to the end (and removing the old backup)?
  Warning: Not all of the space available to /t/solaris-data.img appears to be 
used, you can fix the GPT to use all of the space (an extra 176 blocks) or 
continue with the current setting?
  Model:  (file)
  Disk /t/solaris-data.img: 204800s
  Sector size (logical/physical): 512B/512B
  Partition Table: gpt

  Number  Start    End      Size     File system  Name  Flags
   1      256s     188206s  187951s               zfs
   9      188207s  204590s  16384s

If you rerun it without -s, you can actually respond to those prompts.
Hmm... I have just done that, answered "f" (fix) to the two prompts,
and it seemed to succeed (exit 0), yet rerunning that same command,
I see something is not quite right:

  $ ./parted /t/solaris-data.img u s p
  WARNING: You are not superuser.  Watch out for permissions.
  Error: Both the primary and backup GPT tables are corrupt.  Try making a fresh
  table, and using Parted's rescue feature to recover partitions.
  Model:  (file)
  Disk /t/solaris-data.img: 204800s
  Sector size (logical/physical): 512B/512B
  Partition Table: unknown

I'm debugging that right now...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]