Re: newfs_msdos alters disklabel?

2009-06-16 Thread Jeremy O'Brien
On Tue, Jun 09, 2009 at 02:18:59PM +0300, Jussi Peltola wrote:
  
 S skip-quoted skip beyond quoted text 
   

 T toggle-quoted   toggle display of quoted text
 
 Just use a MUA that doesn't suck too much :)
 

Holy crap. I had no idea mutt could do that! Thanks for the tip!

-- 
Jeremy O'Brien aka neutral_insomniac
GPG key: 0xB1140FDB http://pohl.ececs.uc.edu/~jeremy/jeremy.asc



Re: newfs_msdos alters disklabel?

2009-06-09 Thread Jussi Peltola
On Mon, Jun 08, 2009 at 07:43:22PM -0400, Nick Holland wrote:
 condensing... (Those who scream about the horror of top posting
 obviously don't have a netbook.  Having to flip down twenty
 screens worth just to see something one hasn't seen five times
 already is annoying and a good way to get ignored by me.)
 
S   skip-quoted skip beyond quoted text 

 
T   toggle-quoted   toggle display of quoted text

Just use a MUA that doesn't suck too much :)

-- 
Jussi Peltola



Re: newfs_msdos alters disklabel?

2009-06-09 Thread Thomas Pfaff
On Tue, 9 Jun 2009 14:18:59 +0300
Jussi Peltola pe...@pelzi.net wrote:
 On Mon, Jun 08, 2009 at 07:43:22PM -0400, Nick Holland wrote:
  condensing... (Those who scream about the horror of top posting
  obviously don't have a netbook.  Having to flip down twenty
  screens worth just to see something one hasn't seen five times
  already is annoying and a good way to get ignored by me.)
  
 S skip-quoted skip beyond quoted text
 T toggle-quoted   toggle display of quoted text
 
 Just use a MUA that doesn't suck too much :)

Says the guy who just added 143 bytes of useless space characters
after the skip beyond quoted  text ;-)

Anyway, I'm quite impressed by some of the people that post here
at how poorly they quote and snip away useless content.  I often
find myself having to scroll through pages of crap to get to the
point, just because the author was too lazy to delete (and often
they just decide to top post instead, which makes it real sweet
to quote and keep context later on).

/rant



newfs_msdos alters disklabel?

2009-06-08 Thread Jan Stary
This is 4.5 trying to create a FAT partition
on an external (USB) 80G disk.

# uname -a
OpenBSD wind.stare.cz 4.5 GENERIC.MP#0 i386

# dmesg | tail
sd0 at scsibus0 targ 1 lun 0: ST980815, A, 3.AL SCSI0 0/direct fixed
sd0: 76319MB, 512 bytes/sec, 156301488 sec total
sd0 detached
scsibus0 detached
umass0 detached
umass0 at uhub0 port 5 configuration 1 interface 0 Prolific Technology Inc. 
Mass Storage Device rev 2.00/1.00 addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: ST980815, A, 3.AL SCSI0 0/direct fixed
sd0: 76319MB, 512 bytes/sec, 156301488 sec total

# fdisk -i sd0
Do you wish to write new MBR and partition table? [n] y
Writing MBR at offset 0.

# fdisk sd0
Disk: sd0   geometry: 9729/255/63 [156301488 Sectors]
Offset: 0   Signature: 0xAA55
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]
---
 0: 00  0   0   0 -  0   0   0 [   0:   0 ] unused  
 1: 00  0   0   0 -  0   0   0 [   0:   0 ] unused  
 2: 00  0   0   0 -  0   0   0 [   0:   0 ] unused  
*3: A6  0   1   1 -   9728 254  63 [  63:   156296322 ] OpenBSD 

# disklabel -E sd0
# Inside MBR partition 3: type A6 start 63 size 156296322
Treating sectors 63-156296385 as the OpenBSD portion of the disk.
You can use the 'b' command to change this.

Initial label editor (enter '?' for help at any prompt)
 z
 a
partition: [a] 
offset: [63] 
size: [156296322] 30g
Rounding to cylinder: 62926542
FS type: [4.2BSD] msdos
 w
 q
No label changes.

# disklabel sd0
# Inside MBR partition 3: type A6 start 63 size 156296322
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: A   
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 9729
total sectors: 156301488
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0   # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

16 partitions:
#size   offset  fstype [fsize bsize  cpg]
  a: 62926542   63   MSDOS   
  c:1563014880  unused   

# newfs_msdos sd0a
/dev/rsd0a: 62803840 sectors in 7850480 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=63 hds=255 hid=63 bsec=62926542 
bspf=61332 rdcl=2 infs=1 bkbs=2

# disklabel sd0
# Inside MBR partition 3: type A6 start 63 size 156296322
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: A   
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 9729
total sectors: 156301488
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0   # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

16 partitions:
#size   offset  fstype [fsize bsize  cpg]
  c:1563014880  unused   


The 'a' partiton is there, but once I try to create a filesystem on it,
it disappears from the disklabel. Am I missing something?

The same happens with smaller sizes, for example if I make sd0 to be 
128m in the disklabel.

The same happens with various options to newfs_msdos
(different FAT types).

Also, why does disklabel say '16 partitions'?

Thanks

Jan



# dmesg
OpenBSD 4.5-stable (GENERIC.MP) #0: Sun Jun  7 07:28:16 CEST 2009
r...@wind.stare.cz:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel(R) Atom(TM) CPU 230 @ 1.60GHz (GenuineIntel 686-class) 1.60 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,TM2,CX16,xTPR
real mem  = 1064660992 (1015MB)
avail mem = 1021157376 (973MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 11/17/08, BIOS32 rev. 0 @ 0xf0010, SMBIOS 
rev. 2.5 @ 0xfbeb0 (31 entries)
bios0: vendor MICRO-STAR INTERNATIONAL CO., LTD version 1.60 date 11/17/2008
bios0: MICRO-STAR INTERNATIONAL CO., LTD MS-7418
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC MCFG OEMB HPET
acpi0: wakeup devices P0P2(S4) P0P1(S4) EUSB(S4) MC97(S4) P0P4(S4) P0P5(S4) 
P0P6(S4) P0P7(S4) P0P8(S4) P0P9(S4) USB0(S1) USB1(S1) USB2(S1) USB3(S1) SLPB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 133MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU 230 @ 1.60GHz (GenuineIntel 686-class) 1.60 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,TM2,CX16,xTPR
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 1, remapped to apid 2
acpihpet0 

Re: newfs_msdos alters disklabel?

2009-06-08 Thread Nick Holland
Jan Stary wrote:
 This is 4.5 trying to create a FAT partition
 on an external (USB) 80G disk.

condensing... (Those who scream about the horror of top posting
obviously don't have a netbook.  Having to flip down twenty
screens worth just to see something one hasn't seen five times
already is annoying and a good way to get ignored by me.)
...
 # fdisk -i sd0

...openbsd partition created...

 *3: A6  0   1   1 -   9728 254  63 [  63:   156296322 ] OpenBSD   
   
 
 # disklabel -E sd0
 # Inside MBR partition 3: type A6 start 63 size 156296322
 Treating sectors 63-156296385 as the OpenBSD portion of the disk.
 You can use the 'b' command to change this.
 
 Initial label editor (enter '?' for help at any prompt)
 z
 a
 partition: [a] 
 offset: [63] 
 size: [156296322] 30g
 Rounding to cylinder: 62926542
 FS type: [4.2BSD] msdos

whoa.
You just made your OpenBSD partition into an OpenBSD partition
with an msdos identifier string.  You don't want to do that.

From this point onwards, things are broke.  It just takes you
a while to realize it. :)
...

 The 'a' partiton is there, but once I try to create a filesystem on it,
 it disappears from the disklabel. Am I missing something?

yes. :)

Don't think of I must do this, then that, then bla and then
all is well.  Think about the data...what is where and what it
all means.

On i386 and similar systems, the fdisk partition table determines
what OS goes where.  It is in the first sector on the disk, all
co-existing i386 OSs know that and expect it there, as does the
boot ROM in the machine.  Problem number 1 is you carved out an
OpenBSD partition and tried to call it MSDOS within OpenBSD.

Problem #2 is you created a disklabel on a drive that you had no
intention on using for OpenBSD.  Disklabels are an OpenBSD way to
slice up the OpenBSD partition of the disk.  Only OpenBSD uses
OpenBSD disklabels.  Ask yourself this question: where do you
does the OpenBSD disklabel go on the disk?  In the OpenBSD
partition, of course, no where else is safe for it to be.
OpenBSD knows to work around and use the disklabel.

Now, you make an MSDOS FAT file system on the OpenBSD partition.
What happens to the disklabel?  Yes, you just clobbered it.
MSDOS never had reason to think about working around an OpenBSD
disklabel.  It doesn't.  By this point in time, even if MS
decided it wanted to offer full support for OpenBSD, it can't.

When you PROPERLY create an MSDOS partition on your disk (and
not an OpenBSD partition), OpenBSD will see it and create a
pretend disklabel for you that will be and do everything you
need a disklabel to do.  Do not try to change it, you won't
do better than what is there, and more importantly, where do you
think the disklabel would end up?

See most of FAQ14 for a lot more details on this.

You need to create an MSDOS partition, let the system create its
own disklabel for you, and then newfs that.  Or better: just use
a native MSDOS or Windows machine create the partition for you.
OpenBSD has the ability to create valid drive layouts that
Windows is confused by (it can also create some really wacked
invalid layouts, too), and philosophically, I tend to prefer
to use native tools when possible.

 Also, why does disklabel say '16 partitions'?

That is how many disklabel partitions OpenBSD supports on all
platforms.  You may think this uninteresting, but that means you
haven't played with SPARC systems which usually only support
eight partitions...but with OpenBSD, magic happens and you end
up with 16 partitions in such a way that the SPARC boot ROMs
(and even Solaris to some degree) still work (for the first eight).
Even if you don't use them, all 16 partition table entries exist
and could be used later, if needed.

Nick.



Re: newfs_msdos alters disklabel?

2009-06-08 Thread Tony Abernethy
Jan Stary wrote:
 
 This is 4.5 trying to create a FAT partition
 on an external (USB) 80G disk.
 
snip
 
 Also, why does disklabel say '16 partitions'?
 
   Thanks
 
   Jan

fdisk plays with DOS (windows) partitions. There are 4 of them.
disklabel plays with OpenBSD partitions. There are 16 of them.

This is from a Lenovo T43 booted from 2G USB drive.
Fdisk partition 0 (DOS fdisk will call it partition 1) Dos partition
This is the same disk as disklable partition i (sd0i)
There is also fdisk partition 3 (DOS fdisk would call it partition 4)
OpenBSD partition.
The OpenBSD space is sd0a and sd0b
The c partition refers to the entire disk regardless of who does or does not
own any part of it.

# fdisk sd0
Disk: sd0   geometry: 3949/16/63 [3981312 Sectors]
Offset: 0   Signature: 0xAA55
Starting Ending LBA Info:
 #: id  C   H   S -  C   H   S [   start:size ]

---
 0: 0B  0   1   1 -   1928   6  63 [  63: 1943802 ] Win95
FAT-32
 1: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
 2: 00  0   0   0 -  0   0   0 [   0:   0 ] unused
*3: A6   1928   7   1 -   3936   8  63 [ 1943865: 2024190 ] OpenBSD
# disklabel sd0
# /dev/rsd0c:
...
16 partitions:
#size   offset  fstype [fsize bsize  cpg]
  a:  1992675  1943865  4.2BSD   2048 163841 # /
  b:31515  3936540swap
  c:  39813120  unused
  i:  1943802   63   MSDOS

(This is after several rounds of messing around including completely zeroing
the drive,
so the disk geometry may be the worst possible. So far it seems to work,
kinda slow)