DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

No linux system.

Anyway, I repartitioned the disk using Vista's tool and now it looks like this from OpenBSD:
Code:
Disk: sd0	geometry: 32301/240/63 [488397168 Sectors]
Offset: 0	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0  32  33 -    203  74  26 [        2048:     3072000 ] HPFS/QNX/AUX
 1: 07    203  74  27 -   7137 239  63 [     3074048:   104852512 ] HPFS/QNX/AUX
 2: 0F   7138   1  63 -  30945 239  63 [   107926685:   359976835 ] Extended LBA
 3: 07  30946 178  19 -  32301  57  41 [   467914752:    20480000 ] HPFS/QNX/AUX
Offset: 107926685	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 06   7138  15  48 -  14073  22   6 [   107927552:   104857600 ] DOS > 32MB  
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
Hopefully it will work after I restore OpenBSD.
Reply With Quote
Old 11th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Be sure to recreate OpenBSD's PBR after restoring, using installboot(8). e.g., from bsd.rd:
Code:
# mount /dev/sd0a /mnt
# /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot sd0
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

It works fine form Vista's boot manager, no need for NeoGrub.
Great, thanks a lot! (In fact I was stuck, without running your command it would not work).
By the way, why is it after restore /tmp is writable only by root?
Reply With Quote
Old 11th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by gosha View Post
why is it after restore /tmp is writable only by root?
I don't know, because you haven't posted any information about /tmp.

Is /tmp a separate filesystem?

How did you back up and how did you restore your system? If you used tar(1), and did not use the "p" option on restore, your file permissions and ownership will be broken, system-wide, and you will have to re-start your restore again.

But even, minimally, the output of:
Code:
$ ls -ld /tmp
would have been helpful.

However, I will guess, since guess is all that I can do, that you need to issue:
Code:
# chmod 1777 /tmp
I cannot tell you if you have a damaged system or not.
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

I used dump and restore, using "restore -rf"
I did not compress the dumps, because they're not so big.
/tmp ended up being only rx for group and others.
Everything else seems to be fine

Added:
Now I have another little problem.
Disklabel does not see my ext3 partition (I formatted it using gparted), it is seen fine by Vista though.
And for some reason it suddenly does not see the third Lenovo partition:
Code:
$ fdisk sd0
Disk: sd0	geometry: 32301/240/63 [488397168 Sectors]
Offset: 0	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0  32  33 -    203  74  26 [        2048:     3072000 ] HPFS/QNX/AUX
 1: 07    203  74  27 -   7137 239  63 [     3074048:   104852512 ] HPFS/QNX/AUX
 2: 0F   7138   1  63 -  30945 239  63 [   107926685:   359976835 ] Extended LBA
 3: 07  30946 178  19 -  32301  57  41 [   467914752:    20480000 ] HPFS/QNX/AUX
Offset: 107926685	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: A6   7138  15  48 -  14073  22   6 [   107927552:   104857600 ] OpenBSD     
 1: 0F  14073  22   7 -  16153 176  32 [   212785152:    31459328 ] Extended LBA
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 212785152	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 06  14073  54  39 -  16153 176  32 [   212787200:    31457280 ] DOS > 32MB  
 1: 0F  16153 176  33 -  16431  65  17 [   244244480:     4196352 ] Extended LBA
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 244244480	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 06  16153 209   2 -  16431  65  17 [   244246528:     4194304 ] DOS > 32MB  
 1: 0F  16431  65  18 -  30945 223  15 [   248440832:   219461632 ] Extended LBA
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 248440832	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 83  16431  97  50 -  30945 223  15 [   248442880:   219459584 ] Linux files*
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
Code:
$ disklabel sd0
# Extended partition 2: type 0F start 107926685 size 359976835
# Inside MBR partition 0: type A6 start 867 size 104857600
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: ST9250827AS     
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 240
sectors/cylinder: 15120
cylinders: 32301
total sectors: 488397168
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:           210688        107927552  4.2BSD   2048 16384    1 
  b:          8391600        108138240    swap                   
  c:        488397168                0  unused                   
  d:          4203360        116529840  4.2BSD   2048 16384    1 
  e:          6305040        120733200  4.2BSD   2048 16384    1 
  f:         10493280        127038240  4.2BSD   2048 16384    1 
  g:         20986560        137531520  4.2BSD   2048 16384    1 
  h:         54267072        158518080  4.2BSD   2048 16384    1 
  i:          3072000             2048    NTFS                   
  j:        104852512          3074048    NTFS

Last edited by gosha; 11th August 2009 at 02:56 PM.
Reply With Quote
Old 11th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

It is possible that the kernel doesn't recurse beyond the first extended partition table while creating fictitious label entries.

Why did you create so many in the first place? it looks very odd.
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
Why did you create so many in the first place? it looks very odd.
I agree it looks odd. I was thinking about installing Opensuse to try it outside qemu. I made the partitions inside vista, and this is out it looks like once in OpenBSD.
Reply With Quote
Old 11th August 2009
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

I believe there should only be 1 partition defined in each extended partition table. Two are to be unused and the other acts as a pointer to the next extended partition. So if you have a bunch of logical partitions you need a bunch of extended partitions to hold them.
Reply With Quote
Old 12th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Ok, I usually cannot be satisfied until I get things working the way I want.
I reinstalled the original hard disk image with dd to have a clean start again.
Then I partitioned with Gparted instead than using Vista. It seems that now both Vista and OpenBSD like the result.
This is fdisk:
Code:
Disk: sd0	geometry: 32301/240/63 [488397168 Sectors]
Offset: 0	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0  32  33 -    203  74  26 [        2048:     3072000 ] HPFS/QNX/AUX
 1: 07    203  74  27 -   7137 239  63 [     3074048:   104852512 ] HPFS/QNX/AUX
 2: 07  30946 178  19 -  32301  57  41 [   467914752:    20480000 ] HPFS/QNX/AUX
 3: 05   7138   0   1 -  30945 239  63 [   107926560:   359976960 ] Extended DOS
Offset: 107926560	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: A6   7138   1   1 -  14072 239  63 [   107926623:   104857137 ] OpenBSD     
 1: 05  14073   0   1 -  16153 239  63 [   212783760:    31464720 ] Extended DOS
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 212783760	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 83  14073   1   1 -  16153 239  63 [   212783823:    31464657 ] Linux files*
 1: 05  16154   0   1 -  16430 239  63 [   244248480:     4188240 ] Extended DOS
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 244248480	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 82  16154   1   1 -  16430 239  63 [   244248543:     4188177 ] Linux swap  
 1: 05  16431   0   1 -  30945 239  63 [   248436720:   219466800 ] Extended DOS
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
Offset: 248436720	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 83  16431   1   1 -  30945 239  63 [   248436783:   219466737 ] Linux files*
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
and this is disklabel:
Code:
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: ST9250827AS     
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 240
sectors/cylinder: 15120
cylinders: 32301
total sectors: 488397168
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:           211617        107926623  4.2BSD   2048 16384    1 
  b:          8391600        108138240  4.2BSD   2048 16384    1 
  c:        488397168                0  unused                   
  d:          4203360        116529840  4.2BSD   2048 16384    1 
  e:          6305040        120733200  4.2BSD   2048 16384    1 
  f:         10493280        127038240  4.2BSD   2048 16384    1 
  g:         20986560        137531520  4.2BSD   2048 16384    1 
  h:         54265680        158518080  4.2BSD   2048 16384    1 
  i:          3072000             2048    NTFS                   
  j:        104852512          3074048    NTFS                   
  k:         20480000        467914752    NTFS                   
  l:         31464657        212783823  ext2fs                   
  m:          4188177        244248543 unknown                   
  n:        219466737        248436783  ext2fs
OpenBSD boots fine using Vista's boot manager, and now I'll try to install Opensuse, but I guess at this point everything seems to be just working.

Thanks to you all.
Reply With Quote
Old 12th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I don't know why you bothered to assign your Linux swap partition to disklabel partition m.

I note there are three small gaps: 2048 sectors (1MB) is skipped at the beginning of the drive, before NTFS partition i, and again before partition j. 11232 sectors (5.4MB) is skipped between ext2fs partition (n) and your 3rd NTFS partition (k).
Reply With Quote
Old 12th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
I don't know why you bothered to assign your Linux swap partition to disklabel partition m.
I'm very unfamiliar with linux, and the few times I tried to install (on real machine or qemu) I noticed it will automatically request a swap partition. Can I do without?

Quote:
I note there are three small gaps: 2048 sectors (1MB) is skipped at the beginning of the drive, before NTFS partition i, and again before partition j. 11232 sectors (5.4MB) is skipped between ext2fs partition (n) and your 3rd NTFS partition (k).
Maybe this has been done by Gparted? Is this a problem?

Well, I checked the original mbr (before ever using gparted, at that time I used Vista's tool to shrink its own partition, and the gap at the beginning of the drive was already there:
Code:
$ cat mbr.fdisk.bak
Disk: sd0	geometry: 32301/240/63 [488397168 Sectors]
Offset: 0	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0  32  33 -    203  74  26 [        2048:     3072000 ] HPFS/QNX/AUX
 1: 07    203  74  27 -  22148  14  62 [     3074048:   331804656 ] HPFS/QNX/AUX
 2: 07  30946 178  19 -  32301  57  41 [   467914752:    20480000 ] HPFS/QNX/AUX
 3: A6  22148  14  63 -  30946 178  18 [   334878704:   133036048 ] OpenBSD
Reply With Quote
Old 12th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by gosha View Post
Can I do without?
You can do without any disklabel partition that you will never mount. The default install supports the ext2fs file systems with mount_ext2fs(8). The NTFS file systems can be mounted read only, with a custom kernel. If you don't plan to mount any foreign file systems, you do not need disklabel partitions describing them.
Quote:
Maybe this has been done by Gparted? Is this a problem?
It's not a problem, it's just some sectors that will never be used.
Reply With Quote
Old 12th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
You can do without any disklabel partition that you will never mount. The default install supports the ext2fs file systems with mount_ext2fs(8). The NTFS file systems can be mounted read only, with a custom kernel. If you don't plan to mount any foreign file systems, you do not need disklabel partitions describing them.
Well maybe I did not understand exactly what you said here:
Quote:
I don't know why you bothered to assign your Linux swap partition to disklabel partition m.
In fact I did not bother, the partitions in disklabel came up by themselves.
Reply With Quote
Old 12th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

*IF* there is no OpenBSD disklabel on the drive, OpenBSD will automatically assign MBR partition to disklabel partitions -- just as a convenience, so just in case the OpenBSD admin needs access to a foreign filesystem, he/she does not need to manually add them.

This happens only when there is no disklabel on the drive, and the disklabel is being created.

If, after OpenBSD has been installed, new MBR partitions are added, they will not be added to the disklabel automatically. If any are needed, the admin must add them manually.

So:
  • If you will never need to access your two Linux data partitions from OpenBSD, you may remove them from your disklabel.
  • Unless you run a custom kernel, you may remove your NTFS partitions from your disklabel.
  • You will get no value from your Linux swap partition in your disklabel, so you may remove it.
Reply With Quote
Old 12th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
* If you will never need to access your two Linux data partitions from OpenBSD, you may remove them from your disklabel.
* Unless you run a custom kernel, you may remove your NTFS partitions from your disklabel.
* You will get no value from your Linux swap partition in your disklabel, so you may remove it.
I can understand this.

But this is not so clear to me:
Quote:
If, after OpenBSD has been installed, new MBR partitions are added, they will not be added to the disklabel automatically. If any are needed, the admin must add them manually.
I thought restoring the system (no fresh install) would not create a new disklabel, or does it in fact?
Reply With Quote
Old 12th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I'm going go try to simplify this a little more.. if that's even possible.

OpenBSD always addresses physical disks using disklabel partitions.. on a blank disk, the only partition would be 'c'.

For every disk in the system, a "fake" or "fictitious" label is created within the kernel when no actual label exists on the drive.

If you first booted OpenBSD's RAMDISK kernel, it created a fictitious label with foreign partitions mapped between i and p, after you added your OpenBSD partition and created your OpenBSD specific partitions, you kept the partitions mapped by the kernel in the disklabel you wrote to disk.

Quote:
Originally Posted by disklabel(8)
Note that when a disk has no real BSD disklabel, the kernel creates a default label so that the disk can be used. This default label will include other partitions found on the disk if they are supported on your architecture. For example, on systems that support fdisk(8) partitions the default label will also include DOS and Linux partitions. However, these entries are not dynamic, they are fixed at the time disklabel is run. That means that subsequent changes that affect non-OpenBSD partitions will not be present in the default label, though they may be updated by hand. To see the default label, run disklabel with the -d flag. disklabel can then be run with the -e flag and any entries pasted as desired from the default label into the real one.
So to repeat what jggimi said.. if you add partitions to fdisk AFTER you install OpenBSD, they will not be in your on-disk label, you need to add them manually.. or not at all, if you don't plan on accessing them.
Reply With Quote
Old 12th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by gosha View Post
I thought restoring the system (no fresh install) would not create a new disklabel, or does it in fact?
The disklabel sector is is read from the drive during boot. If there is a valid disklabel, it is retained in system memory. The disklabel(8) utility will use the copy-in-memory unless the admin specifically requests the hard drive's copy be re-read from disk, or, that both the hard drive's disklabel and the in-memory copy be ignored. See the -c and -d option descriptions of the disklabel(8) man page.

The disklabel's sector location varies by architecture. For i386/amd64, it is in the second sector of the OpenBSD MBR partition. If you move the location of the OpenBSD MBR partition on the drive, you will no longer have a valid disklabel.

You used dump/restore. Were your OpenBSD partitions already in the disklabel, or did you have to recreate them? If you recreated them, that would indicate no disklabel found on disk.

AFAIK, newfs(8), dump(8), and restore(8) will not touch the disklabel sector, which in this case, is part of your "a" partition.
Reply With Quote
Old 13th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Thanks a lot to both, things are much clearer now. Partitioning has always been some real black magic to me.

Quote:
You used dump/restore. Were your OpenBSD partitions already in the disklabel, or did you have to recreate them? If you recreated them, that would indicate no disklabel found on disk.
I recreated the partitions before running restore, since restore needs to be run in the mounted partition you want to restore files to (or did I get it wrong?).
And by the way, now I know why my /tmp had write permission only for root after restore, it is because I did not dump it at all, thinking I don't need to dump a partition that gets cleared on every boot. So I just made a fresh /tmp partition.

While I'm here I have another question: does swap need to be formatted with newfs as any other filesystem? I did run newfs on it and it worked fine, but is it right?
Reply With Quote
Old 13th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

No.. you do not run newfs(8) on your swap partition, it has no structure.. and no files are stored on it.

A swap partition has no defined format, it is just a contiguous space for the kernel to dump pages of memory until they're needed again.

You should never write to a swap partition/file, you may end up corrupting data that was written.. fortunately the kernel doesn't care about previously written data after a reboot, so just do that.

EDIT/NOTE: All data on the swap partition is encrypted, so hopefully the kernel is capable of detecting that a page has been corrupted and forces the program requesting the page to be terminated to prevent erratic behaviour, but I don't know if it does for sure.

Last edited by BSDfan666; 13th August 2009 at 03:58 AM.
Reply With Quote
Old 13th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

I see, thank you.
I modified the disklabel so that now it reads: b ... swap.
I guess this should be enough?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Operating BSD partitions through XP SunSpyda OpenBSD General 10 16th September 2009 08:22 PM
How to swap partitions Help revzalot OpenBSD Installation and Upgrading 2 1st September 2009 07:44 AM
backup fdisk partitions gosha OpenBSD General 17 16th July 2009 03:19 AM
Moving ZFS partitions/drives between systems corey_james Guides 2 6th August 2008 08:36 PM
partitions italogf FreeBSD Installation and Upgrading 5 7th July 2008 12:14 PM


All times are GMT. The time now is 06:49 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick