Bootable GPT USB device

Doug Poland doug at polands.org
Sun Jun 14 19:48:48 UTC 2009


Hello,

I'm trying to create a bootable USB drive using the new GEOM_PART_
partitioning technology. Following gpart(8), I've done this...

 gpart create -s GPT da0
 gpart bootcode -b /boot/pmbr da0
 gpart add -b 34 -s 128 -t freebsd-boot da0
 gpart bootcode -p /boot/gptboot -i 1 da0
 gpart add -b 162 -s 2097152 -t freebsd-ufs da0
 gpart add -b 2097314  -s 8388608 -t freebsd-swap da0
 gpart add -b 10485922 -s 2097152 -t freebsd-ufs da0
 gpart add -b 12583074 -s 8388608 -t freebsd-ufs da0
 gpart add -b 20971682 -s 135329773 -t freebsd-ufs da0

# gpart show
=>       34  156301421  da0  GPT  (75G)
         34        128    1  freebsd-boot  (64K)
        162    2097152    2  freebsd-ufs  (1.0G)
    2097314    8388608    3  freebsd-swap  (4.0G)
   10485922    2097152    4  freebsd-ufs  (1.0G)
   12583074    8388608    5  freebsd-ufs  (4.0G)
   20971682  135329773    6  freebsd-ufs  (65G)

 newfs -L boot /dev/da0p2
 newfs -L swap /dev/da0p3
 newfs -UL tmp /dev/da0p4
 newfs -UL var /dev/da0p5
 gjournal load
 gjournal label /dev/da0p6
 newfs -L usrgj /dev/da0p6.journal

 mkdir -p /mnt/{boot,var,tmp,usr}
 mount /dev/ufs/boot /mnt/boot/
 mount /dev/ufs/tmp  /mnt/tmp
 mount /dev/ufs/var  /mnt/var/
 mount -o async /dev/ufs/usrgj /mnt/usr/

 cd /mnt/boot && dump -0aLuC32 -f- /    | restore -rf-
 cd /mnt/tmp  && dump -0aLuC32 -f- /tmp | restore -rf-
 cd /mnt/var  && dump -0aLuC32 -f- /var | restore -rf-
 cd /mnt/usr  && dump -0aLuC32 -f- /usr | restore -rf-

I've tried this on two systems now, 7.1-RELEASE i386 and 7.2-STABLE
amd64.  In each case, I cannot boot from the newly create USB drive. 
I know each machine is capable of USB boot as I have a 4GB thumbdrive
created with the traditional bsdlabel partitioning tools.  Each box
boots nicely off that USB disk.

So, question is, what am I doing wrong?  And, how can use the new disk
partitioning GEOM class to create a bootable, external, USB drive? 
Many thanks in advance.

-- 
Regards,
Doug










More information about the freebsd-questions mailing list