From nobody@FreeBSD.org  Thu Jun  6 22:29:46 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 6C41B6F7
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  6 Jun 2013 22:29:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E1B7190A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  6 Jun 2013 22:29:46 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r56MTjSi011886
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 6 Jun 2013 22:29:45 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r56MTjq4011885;
	Thu, 6 Jun 2013 22:29:45 GMT
	(envelope-from nobody)
Message-Id: <201306062229.r56MTjq4011885@oldred.freebsd.org>
Date: Thu, 6 Jun 2013 22:29:45 GMT
From: Paul Hoffman <phoffman@proper.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Handbook should use gpart instead of fdisk because of larger disks
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         179378
>Category:       docs
>Synopsis:       Handbook should use gpart instead of fdisk because of larger disks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    wblock
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 06 22:30:00 UTC 2013
>Closed-Date:    Mon Jun 10 18:36:25 UTC 2013
>Last-Modified:  Mon Jun 10 18:36:25 UTC 2013
>Originator:     Paul Hoffman
>Release:        9.1
>Organization:
>Environment:
FreeBSD labbackup.proper.com 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec  4 06:55:39 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
http://www.freebsd.org/doc/en/books/handbook/disks-adding.html tells how to add a disk. This fails completely when the disk has large sector sizes. For example, with a new 3TB drive, fdisk says:
  fdisk: could not detect sector size
The answer is to not use fdisk, but instead use gpart, as <http://lists.freebsd.org/pipermail/freebsd-questions/2013-March/249989.html> so snidely points out.

However, there is no cookbook for gpart, and that cookbook should be in the handbook.
>How-To-Repeat:
Use fdisk on a large modern drive
>Fix:
I still haven't worked out all the right steps for gpart.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->wblock 
Responsible-Changed-By: wblock 
Responsible-Changed-When: Fri Jun 7 00:18:35 UTC 2013 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=179378 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/179378: commit references a PR
Date: Mon, 10 Jun 2013 16:57:45 +0000 (UTC)

 Author: wblock
 Date: Mon Jun 10 16:57:30 2013
 New Revision: 41895
 URL: http://svnweb.freebsd.org/changeset/doc/41895
 
 Log:
   Update the Adding Disks section in the Storage chapter.  Use a SATA
   disk device instead of SCSI, use GPT instead of MBR, use gpart instead
   of fdisk/bsdlabel, remove sysinstall example, remove dedicated mode
   example.  The PR below was submitted after an RFC regarding this change
   was posted to the freebsd-doc mailing list, but was entirely relevant.
   http://lists.freebsd.org/pipermail/freebsd-doc/2013-June/022087.html
   
   PR:		docs/179378
   Submitted by:	Paul Hoffman <phoffman@proper.com>
   Reviewed by:	freebsd-doc RFC (no responses after a week)
 
 Modified:
   head/en_US.ISO8859-1/books/handbook/disks/chapter.xml
 
 Modified: head/en_US.ISO8859-1/books/handbook/disks/chapter.xml
 ==============================================================================
 --- head/en_US.ISO8859-1/books/handbook/disks/chapter.xml	Mon Jun 10 12:55:29 2013	(r41894)
 +++ head/en_US.ISO8859-1/books/handbook/disks/chapter.xml	Mon Jun 10 16:57:30 2013	(r41895)
 @@ -180,206 +180,66 @@
      </indexterm>
  
      <para>This section describes how to add a new
 -      <acronym>SCSI</acronym> disk to a machine that currently only
 +      <acronym>SATA</acronym> disk to a machine that currently only
        has a single drive.  First, turn off the computer and install
        the drive in the computer following the instructions of the
        computer, controller, and drive manufacturers.  Reboot
        the system and become <username>root</username>.</para>
  
      <para>Inspect <filename>/var/run/dmesg.boot</filename> to ensure
 -      the new disk was found.  In this example, the newly added SCSI
 -      drive should appear as <devicename>da1</devicename>.</para>
 +      the new disk was found.  In this example, the newly added
 +      <acronym>SATA</acronym> drive will appear as
 +      <devicename>ada1</devicename>.</para>
  
      <indexterm><primary>partitions</primary></indexterm>
 -    <indexterm><primary>slices</primary></indexterm>
      <indexterm>
 -      <primary><command>fdisk</command></primary>
 +      <primary><command>gpart</command></primary>
      </indexterm>
  
 -    <para>&os; runs on IBM-PC compatible computers, therefore it
 -      must take into account the PC BIOS partitions which are
 -      different from the traditional BSD partitions.  A PC disk has up
 -      to four BIOS partition entries.  If the disk is going to be
 -      truly dedicated to &os;, use <emphasis>dedicated</emphasis>
 -      mode.  Otherwise, &os; will have to live within one of the PC
 -      BIOS partitions.  &os; calls the PC BIOS partitions
 -      <emphasis>slices</emphasis> so as not to confuse them with
 -      traditional BSD partitions.  Slices may also be used on a disk
 -      that is dedicated to &os;, but used in a computer that also has
 -      another operating system installed.  This is a good way to avoid
 -      confusing the <command>fdisk</command> utility of non-&os;
 -      operating systems.</para>
 -
 -    <para>In the slice case, the drive will be added as
 -      <filename>/dev/da1s1e</filename>.  This is read as: SCSI disk,
 -      unit number 1 (second SCSI disk), slice 1 (PC BIOS partition 1),
 -      and <filename>e</filename> BSD partition.  In the dedicated
 -      case, the drive will be added as
 -      <filename>/dev/da1e</filename>.</para>
 -
 -    <para>Due to the use of 32-bit integers to store the number of
 -      sectors, &man.bsdlabel.8; is limited to 2^32-1 sectors per disk,
 -      or 2TB in most cases.  The &man.fdisk.8; format allows a
 -      starting sector of no more than 2^32-1 and a length of no more
 -      than 2^32-1, limiting partitions to 2TB and disks to 4TB, in
 -      most cases.  The &man.sunlabel.8; format is limited to 2^32-1
 -      sectors per partition and 8 partitions for a total of 16TB.  For
 -      larger disks, &man.gpart.8; may be used to create
 -      <acronym>GPT</acronym> partitions.  <acronym>GPT</acronym> has
 -      the added benefit of not being limited to 4 slices.</para>
 +    <para>For this example, a single large partition will be created
 +      on the new disk.  The <ulink
 +	url="http://en.wikipedia.org/wiki/GUID_Partition_Table">
 +	<acronym>GPT</acronym></ulink> partitioning scheme will be
 +      used in preference to the older and less versatile
 +      <acronym>MBR</acronym> scheme.</para>
  
 -    <sect2>
 -      <title>Using &man.sysinstall.8;</title>
 -
 -      <indexterm>
 -	<primary><application>sysinstall</application></primary>
 -	<secondary>adding disks</secondary>
 -      </indexterm>
 -      <indexterm>
 -	<primary>su</primary>
 -      </indexterm>
 -
 -      <procedure>
 -	<step>
 -	  <title>Navigating
 -	    <application>sysinstall</application></title>
 -
 -	  <para><command>sysinstall</command> can be used to partition
 -	    and label a new disk using its easy-to-use menus.  As
 -	    <username>root</username>, run
 -	    <command>sysinstall</command> and enter the
 -	    <literal>Configure</literal> menu.  Within the
 -	    <literal>&os; Configuration Menu</literal>, scroll down
 -	    and select the <literal>Fdisk</literal> option.</para>
 -	</step>
 -
 -	<step>
 -	  <title><application>fdisk</application> Partition
 -	    Editor</title>
 -
 -	  <para>Once inside <application>fdisk</application>, pressing
 -	    <keycap>A</keycap> will use the entire disk for &os;.
 -	    When asked whether to <quote>remain cooperative with
 -	      any future possible operating systems</quote>, answer
 -	    <literal>YES</literal>.  Write the changes to the disk
 -	    using <keycap>W</keycap>.  Exit the fdisk editor by
 -	    pressing <keycap>Q</keycap> which will prompt about
 -	    the <quote>Master Boot Record</quote>.  Since the disk is
 -	    being added to an already running system, choose
 -	    <literal>None</literal>.</para>
 -	</step>
 -
 -	<step>
 -	  <title>Disk Label Editor</title>
 -
 -	  <indexterm><primary>BSD partitions</primary></indexterm>
 +    <note>
 +      <para>If the disk to be added is not blank, old partition
 +	information can be removed with
 +	<command>gpart delete</command>.  See &man.gpart.8; for
 +	details.</para>
 +    </note>
  
 -	  <para>Next, exit <application>sysinstall</application> and
 -	    start it again.  Follow the directions above, except this
 -	    time choose the <literal>Label</literal> option.  This
 -	    will enter the <literal>Disk Label Editor</literal>.  This
 -	    editor is used to create traditional BSD partitions.  A
 -	    disk can have up to eight partitions, labeled
 -	    <literal>a-h</literal>.  A few of the partition labels
 -	    have special uses.  The <literal>a</literal> partition is
 -	    used for the root partition (<filename
 -	      class="directory">/</filename>).  Only the disk the
 -	    system boots from should have an <literal>a</literal>
 -	    partition.  The <literal>b</literal> partition is used for
 -	    swap partitions, and there can be many disks with swap
 -	    partitions.  The <literal>c</literal> partition addresses
 -	    the entire disk in dedicated mode, or the entire &os;
 -	    slice in slice mode.  The other partitions are for general
 -	    use.</para>
 -
 -	  <para>The label editor in
 -	    <application>sysinstall</application> favors the
 -	    <literal>e</literal> partition for non-root, non-swap
 -	    partitions.  Within the label editor, create a single file
 -	    system by pressing <keycap>C</keycap>.  When prompted if
 -	    this will be a FS (file system) or swap, choose
 -	    <literal>FS</literal> and type in a mount point such as
 -	    <filename class="directory">/mnt</filename>).  When adding
 -	    a disk in post-install mode,
 -	    <application>sysinstall</application> will not create
 -	    entries in <filename>/etc/fstab</filename>, so the mount
 -	    point you specify is not important.</para>
 -
 -	  <para>Press <keycap>W</keycap> to write the new label to the
 -	    disk and create a file system on it.  Ignore any errors
 -	    from <application>sysinstall</application> indicating that
 -	    it could not mount the new partition.  Exit the label
 -	    editor then <application>sysinstall</application>
 -	    completely.</para>
 -	</step>
 +    <para>The partition scheme is created, and then a single partition
 +      is added:</para>
  
 -	<step>
 -	  <title>Finish</title>
 +    <screen>&prompt.root; <userinput>gpart create -s GPT ada1</userinput>
 +&prompt.root; <userinput>gpart add -t freebsd-ufs ada1</userinput></screen>
  
 -	  <para>The last step is to edit
 -	    <filename>/etc/fstab</filename> to add an entry for your
 -	    new disk.</para>
 -	</step>
 -      </procedure>
 -    </sect2>
 +    <para>Depending on use, several smaller partitions may be desired.
 +      See &man.gpart.8; for options to create partitions smaller than
 +      a whole disk.</para>
  
 -    <sect2>
 -      <title>Using Command Line Utilities</title>
 +    <para>A file system is created on the new blank disk:</para>
  
 -      <sect3>
 -	<title>Using Slices</title>
 +    <screen>&prompt.root; <userinput>newfs -U /dev/ada1</userinput></screen>
  
 -	<para>The setup in the following example allows the new disk
 -	  to work correctly with other operating systems that might be
 -	  installed on the computer without confusing other operating
 -	  systems' <command>fdisk</command> utilities.  This method is
 -	  recommended for new disk installs.  Only use
 -	  <literal>dedicated</literal> mode if there is a good reason
 -	  to do so!</para>
 -
 -	<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 bs=1k count=1</userinput>
 -&prompt.root; <userinput>fdisk -BI da1</userinput> #Initialize your new disk
 -&prompt.root; <userinput>bsdlabel -B -w da1s1 auto</userinput> #Label it.
 -&prompt.root; <userinput>bsdlabel -e da1s1</userinput> # Edit the bsdlabel just created and add any partitions.
 -&prompt.root; <userinput>mkdir -p /1</userinput>
 -&prompt.root; <userinput>newfs /dev/da1s1e</userinput> # Repeat this for every partition you created.
 -&prompt.root; <userinput>mount /dev/da1s1e /1</userinput> # Mount the partition(s)
 -&prompt.root; <userinput>vi /etc/fstab</userinput> # Add the appropriate entry/entries to your <filename>/etc/fstab</filename>.</screen>
 +    <para>An empty directory is created as a
 +      <emphasis>mountpoint</emphasis>, a location for mounting the new
 +      disk in the original disk's file system:</para>
  
 -	<para>For an IDE disk, substitute
 -	  <filename>ad</filename> for <filename>da</filename>.</para>
 -      </sect3>
 +    <screen>&prompt.root; <userinput>mkdir /newdisk</userinput></screen>
  
 -      <sect3>
 -	<title>Dedicated</title>
 +    <para>Finally, an entry is added to
 +      <filename>/etc/fstab</filename> so the new disk will be mounted
 +      automatically at startup:</para>
  
 -	<indexterm><primary>OS/2</primary></indexterm>
 +    <programlisting>/dev/ada1	/newdisk	ufs	rw	2	2</programlisting>
  
 -	<para>If the new drive will not be shared with another
 -	  operating system, <literal>dedicated</literal> mode can be
 -	  used.  This mode can confuse Microsoft operating systems;
 -	  however, no damage will be done by them.  To configure a
 -	  disk in dedicated mode:</para>
 -
 -	<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 bs=1k count=1</userinput>
 -&prompt.root; <userinput>bsdlabel -Bw da1 auto</userinput>
 -&prompt.root; <userinput>bsdlabel -e da1</userinput>				# create the `e' partition
 -&prompt.root; <userinput>newfs /dev/da1e</userinput>
 -&prompt.root; <userinput>mkdir -p /1</userinput>
 -&prompt.root; <userinput>vi /etc/fstab</userinput>				# add an entry for /dev/da1e
 -&prompt.root; <userinput>mount /1</userinput></screen>
 -
 -	<para>An alternate method is:</para>
 -
 -	<screen>&prompt.root; <userinput>dd if=/dev/zero of=/dev/da1 count=2</userinput>
 -&prompt.root; <userinput>bsdlabel /dev/da1 | bsdlabel -BR da1 /dev/stdin</userinput>
 -&prompt.root; <userinput>newfs /dev/da1e</userinput>
 -&prompt.root; <userinput>mkdir -p /1</userinput>
 -&prompt.root; <userinput>vi /etc/fstab</userinput>					# add an entry for /dev/da1e
 -&prompt.root; <userinput>mount /1</userinput></screen>
 +    <para>The new disk can be mounted manually, without restarting the
 +      system:</para>
  
 -      </sect3>
 -    </sect2>
 +    <screen>&prompt.root; <userinput>mount /newdisk</userinput></screen>
    </sect1>
  
    <sect1 id="raid">
 _______________________________________________
 svn-doc-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-doc-all
 To unsubscribe, send any mail to "svn-doc-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: wblock 
State-Changed-When: Mon Jun 10 18:35:46 UTC 2013 
State-Changed-Why:  
Update committed.  Thanks for the report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=179378 
>Unformatted:
