Bug 166673 - sade(8) will not properly format 2TB disk (maybe other sizes as well)
Summary: sade(8) will not properly format 2TB disk (maybe other sizes as well)
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-sysinstall (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-05 16:50 UTC by wynkoop
Modified: 2017-01-22 04:47 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wynkoop 2012-04-05 16:50:09 UTC
1.  Connected USB disk to system and it appeared as /dev/da4.

2.  Started SADE and set the entire disk as a FreeBSD partation (165)

3.  Went to label section and tried to create a single partition.  Writing it resulted in failure and the device node was never created.

4.  sade also dumped core a couple of times.  I can not say exactly why.

Here is a session of trying to get a filesystem on the disk using sade:

---------------------------cut here---------------------------------------

[root@dt0 /home/wynkoop]# dd if=/dev/zero of=/dev/da4 bs=512 count=2048
2048+0 records in
2048+0 records out
1048576 bytes transferred in 0.840691 secs (1247279 bytes/sec)
[root@dt0 /home/wynkoop]# 
[root@dt0 /home/wynkoop]# sade



      +-------------- Disklabel and partitioning utility ---------------+
      | This is a utility for partitioning and/or labelling your disks. |
      | +-------------------------------------------------------------+ |
      | |        1 Partition  Managing disk partitions                | |
      | |        2 Label      Label allocated disk partitions         | |
      | +-------------------------------------------------------------+ |
      +-----------------------------------------------------------------+
      |                     [  OK  ]       Cancel                       |
      +--------------------------[ DISKUTIL ]---------------------------+


    +-------------------------- Select Drive(s) --------------------------+
    | Please select the drive, or drives, on which you wish to perform    |
    | this operation.  If you are attempting to install a boot partition  |
    | on a drive other than the first one or have multiple operating      |
    | systems on your machine, you will have the option to install a boot |
    | manager later.  To select a drive, use the arrow keys to move to it |
    | and press [SPACE] or [ENTER].  To de-select it, press it again.     |
    |                                                                     |
    | Use [TAB] to get to the buttons and leave this menu.                |
    | +-----------------------------------------------------------------+ |
    | |                         [ ] ada0  ada0                          | |
    | |                         [X] da4   da4                           | |
    | +-----------------------------------------------------------------+ |
    +---------------------------------------------------------------------+
    |                       [  OK  ]       Cancel                         |
    +---[ Press F1 for important information regarding disk geometry! ]---+


Disk name:      da4                                    FDISK Partition Editor
DISK Geometry:  243201 cyls/255 heads/63 sectors = 3907024065 sectors (1907726MB
)
Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         63         62        -     12     unused        0
        63 3907024002 3907024064    da4s1      8    freebsd      165
3907024065       5103 3907029167        -     12     unused        0          






The following commands are supported (in upper or lower case):

A = Use Entire Disk   G = set Drive Geometry   C = Create Slice
D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Expert m.
T = Change Type       U = Undo All Changes     W = Write Changes  Q = Finish


Use F1 or ? to get more help, arrow keys to select.

<NOTE>  The above works.  Failure happens at the label stage </NOTE>

<NOTE> Below is just before writing the changes </NOTE>

                         FreeBSD Disklabel Editor

Disk: da4       Partition name: da4s1   Free: 0 blocks (0MB)

Part      Mount          Size Newfs   Part      Mount          Size Newfs
----      -----          ---- -----   ----      -----          ---- -----
da4s1d    /ufs4        1863GB UFS2+S Y




The following commands are valid here (upper or lower case):
C = Create        D = Delete   M = Mount pt.            W = Write
N = Newfs Opts    Q = Finish   S = Toggle SoftUpdates   Z = Custom Newfs
T = Toggle Newfs  U = Undo     A = Auto Defaults        R = Delete+Merge

Use F1 or ? to get more help, arrow keys to select.

<NOTE> Writing the changes results in the following </NOTE>






      +---------------------------- Message ----------------------------+
      |Error mounting /dev/da4s1d on /ufs4 : No such file or directory  |
      +---------------------------------------------------------(100%)--+
      |                          [  OK  ]                               |
      +--------------------[ Press enter or space ]---------------------+


<NOTE> The following are the device nodes I see at this point </NOTE>

[wynkoop@dt0 ~]$ ls -l /dev/da4*
crw-r-----  1 root  operator    0, 164 Apr  5 11:38 /dev/da4
crw-r-----  1 root  operator    0, 166 Apr  5 11:38 /dev/da4s1
[wynkoop@dt0 ~]$ 

<NOTE> /ufs4 was created <?NOTE>

[wynkoop@dt0 ~]$ ls -ld /ufs4
drwxr-xr-x  2 root  wheel  2 Apr  5 11:18 /ufs4
[wynkoop@dt0 ~]$

Fix: 

Figure out what changed in 9.0 that was not taken into account in sade and make sade align with these changes.
How-To-Repeat: Attempt to partition a disk using sade.
Comment 1 wynkoop 2012-04-05 17:54:47 UTC
Greeting-

Just attaching the comments by JKH to the PR.

-Brett

On 05/Apr/2012 12:42 Jordan K. Hubbard <jkh --AT-- freebsd.org> wrote ..
> Hi Brett,
> 
> Yep, everything at Apple is going swimmingly (I see AAPL just hit $631 today -
> no complaints! ;-) ).    I don't know much about sade, I'm afraid, the credit you
> see apparently due to the fact that they took the code out of sysinstall (and,
> now that I look at sade, I see that it does indeed appear to be pretty much the
> very same code).  Given that, I would suspect one of two problems:
> 
> 1. Your geometry is not in fact correct.  You might try the suggested geometry,
> or inspect the geometry under another OS (simply boot Linux or Windows off a thumb
> drive and see how they report the drive geometry for a "2nd opinion") and try
plugging
> those numbers into sade, e.g. hit the "G" key in the Partition editor and manually
> change them.
> 
> 2. You're hitting a bug in libdisk, which sade uses, possibly a 32 bit overflow
> because they didn't have 2Tb disks when phk and I wrote the original code. :)
> 
> - Jordan


--------------------------------------------------------------------------------
email: wynkoop@wynn.com                                                         
Phone: 917-642-6925
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2015-11-10 09:17:42 UTC
sade was moved in to bsdinstall, but has been grossly modified to work with 2TB+ disks I believe. Reassigning to freebsd-sysinstall for input/closure.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2017-01-22 04:26:13 UTC
Canonicalize assignment.
Comment 4 Allan Jude freebsd_committer freebsd_triage 2017-01-22 04:47:41 UTC
MBR cannot support disks larger than 2TB.

You must use a GPT partition table on larger disks.