Date: Fri, 18 Nov 2011 08:48:10 +0400 From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: Marcel Moolenaar <marcel@FreeBSD.org> Cc: freebsd-ppc@FreeBSD.org Subject: Re: IBook G4 and FreeBSD 9.0-RC2: unable to create four slices on hard drive? Message-ID: <4EC5E38A.3060103@FreeBSD.org> In-Reply-To: <2EF7C544-6D08-4A8D-8F6E-EE37225A4135@xcllnt.net> References: <20111116224604.6403be5a.torfinn.ingolfsen@broadpark.no> <4EC4D537.4050704@FreeBSD.org> <20111117124742.50779e7a.torfinn.ingolfsen@broadpark.no> <4EC4F868.9020901@FreeBSD.org> <4EC52908.50000@FreeBSD.org> <2EF7C544-6D08-4A8D-8F6E-EE37225A4135@xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17.11.2011 20:33, Marcel Moolenaar wrote: >> So, i wrote a small patch. It reserves first 14 sectors to be able >> create new partitions. Also, we can add a check that is there some free >> space to extend APM when we are trying to add new partition. >> Marcel what you think about that? > > I don't think it's a good idea for the simple reason that if I > want to split the first partition into 2, I may find that I > cannot recreate the first at the same offset as the one I > deleted, because gpart adjusted the first usable sector. > > The fundamental problem here is that the APM only has 3 entries > usable for partitions and since we don't have a gpart method > for extending the partition table, users just need to destroy > and recreate. Ok. I have read information about APM and it seems our code incorrectly handles the APM self size. We always have assumed that maximum allowed entries == total allocated entries, i.e. self.ent_pmblkcnt. But the size of APM and number of already allocated entries could be different. And it seems that APM created from Mac OS, always has some space reserved for expanding the self. So, there is the patch for review: http://people.freebsd.org/~ae/g_part_apm.diff 1. I changed default number of entries to 30 (actually it could be reduced to 14). New tables will consume 32 sectors and the first available sector for partitions will be 4k aligned. 2. The new table hasn't any preallocated entries. It only has reserved space for APM self. 3. Maximum number of entries is determined from the APM self size. 4. Now we can add new partitions while we have free space in the APM and they will be allocated and ent_pmblkcnt will grow. > In general: don't look too much and/or too often to quick and > dirty "magical" work-arounds or solutions. Understand the > problem and be willing to say that we don't have a solution > for it (yet). Keep the schemes simple and straight-forward > so they all behave the same with roughly the same limitations > and features. Yes, you are right, i need spend some time before make patches :) -- WBR, Andrey V. Elsukov
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EC5E38A.3060103>