
Brian May wrote:
On 13 September 2012 17:53, Trent W. Buck <trentbuck@gmail.com> wrote:
I would completely avoid CHS. My preference also runs to parted beats sfdisk beats fdisk (but note that modern fdisk is implemented on top of libparted).
What units are stored in the partition table?
IIRC an ms-dos disk label has LBA *or* CHS *or* both. WP would know.
$ parted /dev/sdq unit b print
~ # parted /dev/sdq unit b print Error: Can't have a partition outside the disk!
Whoops. I guess this is confirmation that there was a problem.
Salespitch: current-generation parted can also optimize for block alignment. This is off by default.
Shame pvresize doesn't take number of extents for its resize, that would have been more precise. Anyway:
It is, incidentally, an ongoing source of frustration for me that d-i's partman module only operates in SI units. So I tell it to allocate an LV 4G wide, and lvs reports 3.7g, so I then have to go back and lvextend to get it back up to a round number. (No, 4Gi of 4GiB doesn't work, at least as at Ubuntu 12.04.)
How do I update the partition table to end at the correct place? Am guessing this will require deleting the partition and re-adding it with fdisk, or is there a better way?
Unfortunately when parted has a hissy fit and refuses to print out the raw data, I don't know the best way to query it again. Normally I would ask parted to print in bytes, and give either bytes back again (when I want exact alignment), or percentages / GiB units when I want optimal alignment. If you ask parted to start at 0b, it will match more closely than if you ask it to match at 0% or 0GiB. I'm... ambivalent about this "feature".
Am a bit confused how this error occurred in the first place apparently was a standard Centos 5.x install. So maybe a bug in the installer?
Most likely case is you DD from a 2TB disk to another 2TB disk, but the new one is a little bit smaller. Or similar issues of that class.