Re: gpart: can not add MBR partitions with gpart add -t, mbr

2013-06-22 Thread Warren Block

On Fri, 21 Jun 2013, Genre Roger wrote:

When I refer to gpart(8) manpage (9.1 release, updated jan 25,2013), I find 
the description of partition types a bit confusing.


Considering the case of a MoBo with old way Bios (non UEFI), the only 
scheme allowed to get a bootable system is MBR. (Note that after booting, 
your OS is able to manage gpt-scheme on different providers.)


Sorry, I don't understand.  GPT boots fine on a BIOS system.  I'm using 
it on several systems.


Then, if you speak bsd-ish, you are able to add on the MBR-scheme 
provider up to 4 freebsd-type slices, each of them containing up to 8 
partitions with a BSD filesystem (or swap space).


Yes.  This is a partitions-inside-a-slice configuration, used for quite 
a while because it provides more partitions than MBR's four, and also 
because it allows a standard PC to multi-boot from any of the four MBR 
slices.  Technically, it's a hack.  It's complex and shows that both 
partitioning schemes (MBR and bsdlabel) have weaknesses.


Or, if you speak msdos-ish, you would be able to add on the MBR provider 
up to 4 msdos-type partitions (or 3 + 1 extended ), each of them containing 
one filesystem.


The manpage does'nt list explicitly the type for this second case; Oliver try 
to use mbr, decribed as A partition that is sub-partitioned by a Master 
Boot Record (MBR). This type is known as 
!024dee41-33e7-11d3-9d69-0008c781f39f  by GPT.. Such definition is'nt very 
explicit.


In general, it's rare to find a FreeBSD system that uses MBR slices 
directly because there are only four.  But it can be done by combining 
one or more of the standard filesystems and not subdividing the slices:


ada0s1: freebsd (/, /var, /tmp, and /usr combined into a single
 / filesystem)
ada0s2: swap

That would leave s3 and s4 available for other uses.


Let me show the example below on my provider ada0 :


$ gpart show
=   63  976773105  ada0  MBR  (465G)
 63  136314864 1  freebsd  [active]  (65G)
  136314927  840458241- free -  (400G)

=0  136314864  ada0s1  BSD  (65G)
  08388608   1  freebsd-ufs  (4.0G)
8388608   16777216   2  freebsd-swap  (8.0G)
   25165824   16777216   4  freebsd-ufs  (8.0G)
   419430408388608   5  freebsd-ufs  (4.0G)
   50331648   85983215   6  freebsd-ufs  (41G)
  136314863  1  - free -  (512B)

$ sudo gpart add -t mbr -i 2 -s 8G ada0
Password:
gpart: Invalid argument


MBR is not a type of partition, it is a partitioning method or scheme 
as the gpart man page calls them.  The partitioning scheme is dictated 
by the type of system.  Standard x86 computers are only going to be able 
to use MBR or GPT.



$ sudo gpart add -t \!12 -i 2 -s 8G ada0
ada0s2 added


\!12 is just an MS-DOS partition (FAT32 with LBA).


$ sudo newfs_msdos ada0s2
/dev/ada0s2: 16773056 sectors in 262079 FAT32 clusters (32768 
bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 
SecPerTrack=63 Heads=16 HiddenSecs=0 HugeSectors=16777215 FATsecs=2048 
RootCluster=2 FSInfo=1 Backup=2

$ sudo gpart add -t freebsd -i 3 -s 8G ada0
ada0s3 added
$ gpart show ada0
=   63  976773105  ada0  MBR  (465G)
 63  136314864 1  freebsd  [active]  (65G)
  136314927   16777215 2  !12  (8G)
  153092142   16777215 3  freebsd  (8G)
  169869357  806903811- free -  (384G)
$ sudo newfs_msdos ada0s3
/dev/ada0s3: 16773056 sectors in 262079 FAT32 clusters (32768 
bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 
SecPerTrack=63 Heads=16 HiddenSecs=0 HugeSectors=16777215 FATsecs=2048 
RootCluster=2 FSInfo=1 Backup=2
$ 
this example show that, if you want a msdos or fat32 partition, both the 
type \!12 or freebsd allows you  to create a partition where you could 
install a msdos filesystem (but the mbr does not).


It shows that MBR is a partitioning scheme, not a partition type.  It 
also demonstrates that newfs_msdos does not check the partition type of 
the partition on which it is creating a filesystem.  Neither does newfs. 
That is appropriate behavior.  The partition type is so that bootcode 
and other software that deals with partitions does not have to guess 
what is on a particular partition, but has it identified explicitly.


Such behaviour is not surprising, (using freebsd-type to format as msdos 
means you don't use the space allowed for labeling);


I don't understand what you are saying there.  Offhand, I can't think of 
any reason to misidentify a partition intentionally.



but what is really the purpose of the listed mbr-type in the gpart(8) manpage?


MBR is a partitioning scheme, comparable to GPT but more limited.  APM 
is a partitioning scheme for PPC Macs, VTOC8 is a partitioning scheme 
for Sparc.


The partitioning scheme determines which types of partitions are 
allowed.  For MBR, there are lots of partition types for variations for 
MS-DOS (including type 12), one (really) for NTFS, 

Re: gpart: can not add MBR partitions with gpart add -t, mbr

2013-06-21 Thread Genre Roger

Hi,

When I refer to gpart(8) manpage (9.1 release, updated jan 25,2013), I 
find the description of partition types a bit confusing.


Considering the case of a MoBo with old way Bios (non UEFI), the only 
scheme allowed to get a bootable system is MBR. (Note that after 
booting, your OS is able to manage gpt-scheme on different providers.)


Then, if you speak bsd-ish, you are able to add on the MBR-scheme 
provider up to 4 freebsd-type slices, each of them containing up to 8 
partitions with a BSD filesystem (or swap space).


Or, if you speak msdos-ish, you would be able to add on the MBR 
provider up to 4 msdos-type partitions (or 3 + 1 extended ), each of 
them containing one filesystem.


The manpage does'nt list explicitly the type for this second case; 
Oliver try to use mbr, decribed as A partition that is 
sub-partitioned by a Master Boot Record (MBR). This type is known as 
!024dee41-33e7-11d3-9d69-0008c781f39f  by GPT.. Such definition is'nt 
very explicit.


Let me show the example below on my provider ada0 :


$ gpart show
=   63  976773105  ada0  MBR  (465G)
 63  136314864 1  freebsd  [active]  (65G)
  136314927  840458241- free -  (400G)

=0  136314864  ada0s1  BSD  (65G)
  08388608   1  freebsd-ufs  (4.0G)
8388608   16777216   2  freebsd-swap  (8.0G)
   25165824   16777216   4  freebsd-ufs  (8.0G)
   419430408388608   5  freebsd-ufs  (4.0G)
   50331648   85983215   6  freebsd-ufs  (41G)
  136314863  1  - free -  (512B)

$ sudo gpart add -t mbr -i 2 -s 8G ada0
Password:
gpart: Invalid argument

$ sudo gpart add -t \!12 -i 2 -s 8G ada0
ada0s2 added
$
$ sudo newfs_msdos ada0s2
/dev/ada0s2: 16773056 sectors in 262079 FAT32 clusters (32768 
bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 
SecPerTrack=63 Heads=16 HiddenSecs=0 HugeSectors=16777215 FATsecs=2048 
RootCluster=2 FSInfo=1 Backup=2

$ sudo gpart add -t freebsd -i 3 -s 8G ada0
ada0s3 added
$ gpart show ada0
=   63  976773105  ada0  MBR  (465G)
 63  136314864 1  freebsd  [active]  (65G)
  136314927   16777215 2  !12  (8G)
  153092142   16777215 3  freebsd  (8G)
  169869357  806903811- free -  (384G)
$ sudo newfs_msdos ada0s3
/dev/ada0s3: 16773056 sectors in 262079 FAT32 clusters (32768 
bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 
SecPerTrack=63 Heads=16 HiddenSecs=0 HugeSectors=16777215 FATsecs=2048 
RootCluster=2 FSInfo=1 Backup=2
$ 
this example show that, if you want a msdos or fat32 partition, both 
the type \!12 or freebsd allows you  to create a partition where you 
could install a msdos filesystem (but the mbr does not).


Such behaviour is not surprising, (using freebsd-type to format as 
msdos  means you don't use the space allowed for labeling); but what is 
really the purpose of the listed mbr-type in the gpart(8) manpage?


Cheers

Roger


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: gpart: can not add MBR partitions with gpart add -t, mbr

2013-06-21 Thread Freddie Cash
On Fri, Jun 21, 2013 at 8:08 AM, Genre Roger genre.ro...@orange.fr wrote:

 Hi,

 When I refer to gpart(8) manpage (9.1 release, updated jan 25,2013), I
 find the description of partition types a bit confusing.

 Considering the case of a MoBo with old way Bios (non UEFI), the only
 scheme allowed to get a bootable system is MBR. (Note that after booting,
 your OS is able to manage gpt-scheme on different providers.)


You can boot off GPT partitions using the PMBR bootcode (gpart -b
/boot/pmbr ada0) on just about any system.  I was booting my P4 running
FreeBSD 8.something off a GPT-partitioned USB stick for over a year (maybe
2?) before converting it to PC-BSD 9.1 booting off a ZFS dual-mirror pool
(also using GPT partitioned disks).

Can't speak to the rest of your post.  I only use gpart for GPT partitioned
disks, and use fdisk/bsdlabel for non-GPT partitioned disks.


-- 
Freddie Cash
fjwc...@gmail.com
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: gpart: can not add MBR partitions with gpart add -t, mbr

2013-06-21 Thread Genre Roger

Hi,

You're right on the ability to boot off a gpt partition, with a non-uefi 
bios. Sorry for the noise concerning that point.


Cheers

Roger
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: gpart: can not add MBR partitions with gpart add -t mbr

2013-06-19 Thread Warren Block

On Tue, 18 Jun 2013, O. Hartmann wrote:



Having a 1TB disk with a MBR partition layout created successfully with
gpart create -s MBR ada4, which is shown as

Geom name: ada4
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 1953525167
first: 63
entries: 4
scheme: MBR
Consumers:
1. Name: ada4
  Mediasize: 1000204886016 (931G)
  Sectorsize: 512
  Mode: r0w0e0


it is impossible for me to create a partition with

gpart add -t mbr ada4

as it can be read in the manpage of gpart.


I can't find that in 9-stable or -head.  If it's a literal example, 
please point it out and I'll fix it.



Whatever I do, I receive a
useless error from gpart

gpart: Invalid argument

with no further information.

In kernel, I already added GEOM_MBR. geom_part_mbr and geom_part_ldm
kernel modules are then already loaded.

I tried to figure out what's going wrong but this seems highly
enigmatic.

What am I doing wrong?


mbr is partitioning scheme, not a partition type.  Common MBR 
partition types that gpart knows by name are freebsd, freebsd-ufs, 
freebsd-zfs, ntfs, no doubt lots of others but offhand I don't know 
where to get the whole list.


Examples shown here (MBR in the second half):
http://www.wonkity.com/~wblock/docs/html/disksetup.html

Numbers can also be used for partition types by prefixing them with an 
exclamation point, but that must be escaped to keep the shell from 
interpreting it:


  gpart add -t \!12 -s1G ada0

That would add a FAT32X/LBA partition.  There's a list of values here: 
http://en.wikipedia.org/wiki/Partition_type

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


gpart: can not add MBR partitions with gpart add -t mbr

2013-06-18 Thread O. Hartmann

Having a 1TB disk with a MBR partition layout created successfully with
gpart create -s MBR ada4, which is shown as

Geom name: ada4
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 1953525167
first: 63
entries: 4
scheme: MBR
Consumers:
1. Name: ada4
   Mediasize: 1000204886016 (931G)
   Sectorsize: 512
   Mode: r0w0e0


it is impossible for me to create a partition with 

gpart add -t mbr ada4

as it can be read in the manpage of gpart. Whatever I do, I receive a
useless error from gpart

gpart: Invalid argument

with no further information. 

In kernel, I already added GEOM_MBR. geom_part_mbr and geom_part_ldm
kernel modules are then already loaded.

I tried to figure out what's going wrong but this seems highly
enigmatic. 

What am I doing wrong?

Regards and thanks,

Oliver


signature.asc
Description: PGP signature


Re: gpart: can not add MBR partitions with gpart add -t mbr

2013-06-18 Thread Trond Endrestøl
On Tue, 18 Jun 2013 11:09+0200, O. Hartmann wrote:

 
 Having a 1TB disk with a MBR partition layout created successfully with
 gpart create -s MBR ada4, which is shown as
 
 Geom name: ada4
 modified: false
 state: OK
 fwheads: 16
 fwsectors: 63
 last: 1953525167
 first: 63
 entries: 4
 scheme: MBR
 Consumers:
 1. Name: ada4
Mediasize: 1000204886016 (931G)
Sectorsize: 512
Mode: r0w0e0
 
 
 it is impossible for me to create a partition with 
 
 gpart add -t mbr ada4

Right, that should be a partition, not a partition table.

Try: gpart add -t freebsd-ufs ada4

 as it can be read in the manpage of gpart. Whatever I do, I receive a
 useless error from gpart
 
 gpart: Invalid argument
 
 with no further information. 
 
 In kernel, I already added GEOM_MBR. geom_part_mbr and geom_part_ldm
 kernel modules are then already loaded.
 
 I tried to figure out what's going wrong but this seems highly
 enigmatic. 
 
 What am I doing wrong?
 
 Regards and thanks,
 
 Oliver

-- 
+---++
| Vennlig hilsen,   | Best regards,  |
| Trond Endrestøl,  | Trond Endrestøl,   |
| IT-ansvarlig, | System administrator,  |
| Fagskolen Innlandet,  | Gjøvik Technical College, Norway,  |
| tlf. mob.   952 62 567,   | Cellular...: +47 952 62 567,   |
| sentralbord 61 14 54 00.  | Switchboard: +47 61 14 54 00.  |
+---++___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org