misc/164267: bsdinstall(8) bugs when RE-installing to GPT partitions

Garance A Drosehn drosih at rpi.edu
Wed Jan 18 01:40:12 UTC 2012

>Number:         164267
>Category:       misc
>Synopsis:       bsdinstall(8) bugs when RE-installing to GPT partitions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 18 01:40:09 UTC 2012
>Originator:     Garance A Drosehn
>Release:        9.0-RELEASE
FreeBSD echoes64.netel.rpi.edu 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

I ran into some odd problems when trying to partition a disk into GPT chunks.  I believe this is an oversight in the installer, which came up for me due to the odd order that I went about partitioning things.

I first got the ISO's: FreeBSD-9.0-RELEASE-i386-dvd1.iso  and  FreeBSD-9.0-RELEASE-amd64-dvd1.iso and burned those to DVD.  I had a new PC which arrived with Ubuntu already installed on it, and Ubuntu was installed with MBR-style partitions.

I wasn't sure if I wanted i386 or amd64 on this machine.  So first I used the i386 installer, and formatted the disk with the following GPT partitions, which completely replaced the MBR-style partitions in the original install:

Filesystem   1024-blocks    Used    Avail Capacity  Mounted on
/dev/ada0p2      1410716  218456  1079404    17%    /
/dev/ada0p4      1813916   14448  1654356     1%    /xA64
/dev/ada0p5      1108380    9296  1010416     1%    /var
/dev/ada0p6      1209116    9668  1102720     1%    /xA64/var
/dev/ada0p7      8245660 2418048  5167960    32%    /usr
/dev/ada0p8      9282332   32836  8506912     0%    /xA64/usr
/dev/ada0p9     21662876   32836 19897012     0%    /ucvs
/dev/ada0p10     7220892   32836  6610388     0%    /uobj
/dev/ada0p11     2063900   16440  1882348     1%    /tmp
/dev/ada0p12    15478556   32844 14207428     0%    /Users

(there was also a freebsd-swap partition on ada0p2.  And a 128-KB freebsd-boot partition at ada0p2.  Yes, I custom-created that at 128-KB instead of using the default 64-KB).

This seem to work out fine.  I then rebooted into the DVD which had the amd64 installation, and re-used some of the above partitions to install a amd64 image.  When installing, I did not create or install any new partitions, I just picked existing partitions from the above list to use for the amd64 install.  That also worked fine, and when I rebooted into the amd64 system I would see:

Filesystem   1024-blocks    Used    Avail Capacity  Mounted on
/dev/ada0p4      1813916  348088  1320716    21%    /
/dev/ada0p6      1209116   10096  1102292     1%    /var
/dev/ada0p8      9282332 2504140  6035608    29%    /usr
/dev/ada0p9     21662876   32836 19897012     0%    /ucvs
/dev/ada0p10     7220892   32836  6610388     0%    /uobj
/dev/ada0p11     2063900   16440  1882348     1%    /tmp
/dev/ada0p12    15478556   32844 14207428     0%    /Users

So far, so good.  I can switch back-and-forth between the two, and everything seems fine.  But after doing a bunch of testing of my own software, I decide that I don't want that partition layout.  At this point there is nothing critical on the disk, so I boot off the DVD for the AMD64 install, and go to redo the entire thing.  I go into the manual-partitioning screen, and I delete all the partitions I had created earlier, and then created new ones.  However, I did *NOT* delete the top line which said that I wanted GPT-style partitions.  That was still there from the first install, and I still wanted GPT-style partitions so I assumed I didn't need to change that.

The first 8 partitions that I defined in that editor looked fine.  But when I defined the 9th partition, the line for that partition showed a different partition-size than I had specified.  I created some more partitions, and they all showed up with different sizes than I had specified.  In at least one case, the editor showed no value at all for the size of the partition.

I wasn't sure if maybe that happened during the original install and maybe I just had not been paying attention, so I went ahead to define all the partitions I wanted, and hit whatever button it is to finish up and write out the new partitions.  This failed.  I tried this a few times making a variety of different changes in what I was doing, and every time the partitions after #8 would show oddball sizes, and every time the partitioning would fail at one point or another.

I gave up, and defined just 8 partitions.  This worked, and I was able to complete the install without any problems.  Booted up without any problems.  After checking some things (all of which were fine), I tried using 'gpart' to add new partitions.  I forget the exact  details of what happened with that, but I believe I could get gpart to add the partitions, but then I could not get 'mount' to add the new partitions, not even after rebooting.  => Note: I now suspect *this* problem was user-error on my part <=

I redid the entire install a few more times with just 8 partitions, and the install would work but I again I couldn't add partitions once I booted up on the newly installed system.

I was just about to give up and go back to MBR-style partitions just so I could get back to building this PC.  And then I thought... What if I *DO* delete that top entry in the manual partitioning screen of the installer, the one which says I wanted GPT-style partitions?  I was going to have to delete that line if I switched back to MBR-style partitions, so it was worth one more try to delete that line and then add it back in as GPT-style partitions.  So I never really switched to MBR-partitions, but I deleted absolutely everything in the partition editor and then had to respecify that I wanted GPT-style partitions.

This time I added all the partitions I wanted, and they all looked reasonable.  I did the "finish" step, and all partitions were created the way I had specified, and the install completed successfully.  I rebooted, and everything looks fine.  This is now the list of partitions I have:

Filesystem   1024-blocks    Used    Avail Capacity  Mounted on
/dev/ada0p2      1813916  334220  1334584    20%    /
/dev/ada0p3      1713180      20  1576108     0%    /xBak
/dev/ada0p4       281756      24   259192     0%    /xFF
/dev/ada0p6      2116380      24  1947048     0%    /tmp
/dev/ada0p7      1309980   34324  1170860     3%    /var
/dev/ada0p8      9470748 3102336  5610756    36%    /usr
/dev/ada0p9      4229276       8  3890928     0%    /uobj
/dev/ada0p10    12380444       8 11390004     0%    /Users
/dev/ada0p11    24760988       8 22780104     0%    /ucvs
/dev/ada0p12     9282332       8  8539740     0%    /xS2D
/dev/ada0p13     1209116       8  1112380     0%    /xBak/tmp
/dev/ada0p14     1209116       8  1112380     0%    /xBak/var
/dev/ada0p15     8253852       8  7593536     0%    /xBak/usr
/dev/ada0p16     1007516       8   926908     0%    /xFF/tmp
/dev/ada0p17      805916       8   741436     0%    /xFF/var
/dev/ada0p18     3086108       8  2839212     0%    /xFF/usr
/dev/ada0p19     8356252       8  7687744     0%    /xFF/Users

or if you prefer, here's the output of 'gpart show -l':

=>       34  976773101  ada0  GPT  (465G)
         34        256     1  (null)  (128k)    #  <= freebsd-boot
        290    3686400     2  main_Root  (1.8G)
    3686690    3481600     3  altBak_Root  (1.7G)
    7168290     573440     4  pre2012_Root  (280M)
    7741730   18874368     5  (null)  (9.0G)    # <= freebsd-swap
   26616098    4300800     6  main_tmp  (2.1G)
   30916898    2662400     7  main_var  (1.3G)
   33579298   19251200     8  main_usr  (9.2G)
   52830498    8601600     9  main_usrobj  (4.1G)
   61432098   25165824    10  main_Users  (12G)
   86597922   50331648    11  main_usrcvs  (24G)
  136929570   18874368    12  dev_2export  (9.0G)
  155803938    2457600    13  altBak_tmp  (1.2G)
  158261538    2457600    14  altBak_var  (1.2G)
  160719138   16793600    15  altBak_usr  (8.0G)
  177512738    2048000    16  pre2012_tmp  (1G)
  179560738    1638400    17  pre2012_var  (800M)
  181199138    6291456    18  pre2012_usr  (3.0G)
  187490594   16998400    19  pre2012_Users  (8.1G)
  204488994  772284141        - free -  (368G)

And yes, every single one of those partitions is larger than it needs to be.  And as you can see, I have plenty of room to create more partitions!  :-)

So as it stands right now, my PC is formatted the way I wanted it, and seems to be working fine.  But I think there's a bug in bsdinstall (or something that it calls) such that it gets confused if asked to re-partition a GPT-style disk, when that disk is already GPT-partitioned and the user does not explicitly delete and re-specify GPT-style partitions.
Unfortunately I need to get this PC up-and-running to replace a production server which has already been making weird noises for a few weeks, so I can't risk spending much more time on investigating this.  But I wanted to write this much up before I forgot all the details of what happened...
Not investigated.


More information about the freebsd-bugs mailing list