gpart, slice starts at 0
Erich Dollansky
erich at alogt.com
Sat Feb 16 07:51:34 UTC 2013
Hi,
I did this to get a disk partitioned:
#!/bin/tcsh
###############################################################################
#
# File name: FormatSamsung160GB
#
# Description: This script formats a thumb drive connected as da0
#
###############################################################################
#
gpart destroy -F da0
diskinfo da0
dd if=/dev/zero of=/dev/da0 bs=512 count=34
dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774
gpart show -p da0
gpart create -s MBR da0
gpart add -t freebsd da0
gpart show -p da0
gpart show -p da0s1
gpart set -a active -i 1 da0
#
# The following line always gives an error:
#
# gpart create -s BSD da0s1
gpart bootcode -b /boot/mbr da0
gpart bootcode -b /boot/boot da0s1
gpart show -p da0
gpart show -p da0s1
gpart add -t freebsd-ufs -s 512MB -l Samsung160GBroot da0s1
The script results in this output:
FormatSamsung160GB
da0 destroyed
da0 512 160041885696 312581808 0 0 19457
255 63 34+0 records in
34+0 records out
17408 bytes transferred in 0.012732 secs (1367260 bytes/sec)
34+0 records in
34+0 records out
17408 bytes transferred in 0.023717 secs (733983 bytes/sec)
gpart: No such geom: da0.
da0 created
da0s1 added
=> 63 312581745 da0 MBR (149G)
63 312581745 da0s1 freebsd (149G)
=> 0 312581745 da0s1 BSD (149G)
0 312581745 - free - (149G)
active set on da0s1
bootcode written to da0
bootcode written to da0s1
=> 63 312581745 da0 MBR (149G)
63 312581745 da0s1 freebsd [active] (149G)
=> 0 312581745 da0s1 BSD (149G)
0 312581745 - free - (149G)
gpart: Invalid argument
[X220]...Appl/Some Tools (root) > gpart show da0
=> 63 312581745 da0 MBR (149G)
63 312581745 1 freebsd [active] (149G)
[X220]...Appl/Some Tools (root) > gpart show da0s1
=> 0 312581745 da0s1 BSD (149G)
0 312581745 - free - (149G)
I have now two problems which I do not understand. First, why do I need
this line and why does it fail?
gpart create -s BSD da0s1
Second, why does this slice start at 0?
=> 0 312581745 da0s1 BSD (149G)
0 312581745 - free - (149G)
I use this as an starting point:
http://www.wonkity.com/~wblock/docs/html/disksetup.html
It worked for me some time ago.
Did I miss something very, very simple?
Erich
More information about the freebsd-current
mailing list