using /sbin/gpart to add GPT volume

n dhert ndhertbsd at gmail.com
Mon Oct 10 15:33:47 UTC 2011


I have a FreebSD 8.2 machine with 12 1-Tb disks used for making backups.
This is RAID6 with 2 volumes 200GB (system) and 8800 GB (for backup data)
When this machine was installed (jan 2009), I use standard BSD install to
put the system on the 200GB volume

Then I used  /sbin/gpt then to make the second volume available for freeBSD
(since volume 2 is >2Tbyte  gpt was needed)

The situation is now:
Filesystem  1024-blocks       Used      Avail Capacity  Mounted on
/dev/da0s1a     2026030     279538    1584410    15%    /
devfs                 1          1          0   100%    /dev
/dev/da0s1e    20308398        512   18683216     0%    /tmp
/dev/da0s1f    95727204    9599272   78469756    11%    /usr
/dev/da0s1d    20308398    1517948   17165780     8%    /var
/dev/da1p1   8323314852 6484140424 1173309240    85%    /home

I see /sbin/gpt no longer exists, but has been replaced by /sbin/gpart

$ gpart show
=>       63  390624696  da0  MBR  (186G)
         63  390620412    1  freebsd  [active]  (186G)
  390620475       4284       - free -  (2.1M)

=>        0  390620412  da0s1  BSD  (186G)
          0    4194304      1  freebsd-ufs  (2.0G)
    4194304  104857600      2  freebsd-swap  (50G)
  109051904   41943040      4  freebsd-ufs  (20G)
  150994944   41943040      5  freebsd-ufs  (20G)
  192937984  197682428      6  freebsd-ufs  (94G)

=>         34  17187494333  da1  GPT  (8.0T)
           34  17187494333    1  freebsd-ufs  (8.0T)
shows my disks ..


I have free slots for extra disks, If I add disks and make a third RAID6
volume   (da2)
then with gpart I should be able to make a file system of that and mount it
e.g. under /home2 via something like:
# gpart create -s GPT da2
# gpart add -t efi da2    (type efi is a tytpe where GPT partitioning scheme
is used (man gpart))
# gpart show
# newfs /dev/da2p1
# mkdir /home2
# mount /dev/da2p1 /home2
(and edit /etc/vfstab for mounting at boot)

I just wanted to try that out op a PC (is already a triple boot: OpenSUSE,
Windows and FreeBSD 8.2)
Using a CD GParted, I freed up some space so that I have an unallocated
space of 970 MB and rebooted the machine in FreeBSD
# sysinstall / Configure / FDisk shows me:
----------
Disk name:      ad0                                    FDISK Partition
Editor
DISK Geometry:  79780 cyls/16 heads/63 sectors = 80418240 sectors (39266MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype
Flags
         0         63         62        -     12     unused        0
        63   22233897   22233959    ad0s1      4 NTFS/HPFS/QNX        7
  22233960   29639736   51873695    ad0s3      8    freebsd      165
  51873696        189   51873884        -     12     unused        0
  51873885   26539380   78413264    ad0s2      4 extended DOS, LBA       15
  78413265    1992060   80405324    ad0s4      4     ext2fs      131
  80405325      12915   80418239        -     12     unused        0
----------
 (ad0s1 is my Windows, ad0s3 my freebsd, ad0s2 is my OpenSUSE)
 ad0s4 is my free space

gpart so far shows  (nothing created yet in the unallocated space)
$ gpart show
=>      63  80418177  ad0  MBR  (38G)
        63  22233897    1  ntfs  (11G)
  22233960  29639736    3  freebsd  [active]  (14G)
  51873696       189       - free -  (95K)
  51873885  26539380    2  !15  (13G)
  78413265   1992060    4  !131  (973M)
  80405325     12915       - free -  (6.3M)
=>       0  26539380  ad0s2  EBR  (13G)
         0   2072385      1  !130  (1.0G)
   2072385  18249840  32896  !131  (8.7G)
  20322225   6152895  322576  !131  (2.9G)
  26475120     64260         - free -  (31M)
=>       0  29639736  ad0s3  BSD  (14G)
         0   1048576      1  freebsd-ufs  (512M)
   1048576   1994384      2  freebsd-swap  (974M)
   3042960   3092480      4  freebsd-ufs  (1.5G)
   6135440   1048576      5  freebsd-ufs  (512M)
   7184016  22455720      6  freebsd-ufs  (11G)

now I try to create
# gpart create -s GPT ad0s4
gpart: provider: Device not configured

What's wrong?
Well, I see that in 2009 when I used /sbin/gpt, I did try that out also on a
PC, and then used   # gpt create -f /dev/ad0s4
where option -f then meant:  an existing MBR is destroyed and any partitions
described by the MBR are lost.

Must I do a # gpart destroy -F
before # gpart create ...
or what ?

I'm not at all familiar with gpart usage ...
and would like neither to screw up my  PC, nor screw up my backup-system ...


More information about the freebsd-questions mailing list