Re: disklabal messed, need help!

2003-04-05 Thread Ruslan Ermilov
On Wed, Mar 26, 2003 at 01:03:03AM +0800, af asdf wrote:
> 
> Anyone knows how to repair disk when the freebsddisk lable is destroyed?
> 
> I have a 12G HD, the 1st partition is Windows NT, the second the for 
> FreeBSD. For some reason i installed a new disk label to it and newfs it a 
> bit. Once I found the newfs started, I have turned power off right away, 
> but the disk is bad now. anyone knows how to repair this?
> 
Yes.  Read the attached.


Cheers,
-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]   FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
--- Begin Message ---
Hi!

I have my disk set in a so-called dangerously-dedicated mode,
and its disklabel looks like this:

8 partitions:
#size   offsetfstype   [fsize bsize bps/cpg]
  a:  8388608   2621444.2BSD 1024  819216   # (Cyl.  260*- 8582*)
  b:   2621440  swap# (Cyl.0 - 260*)
  c: 199321920unused0 0 # (Cyl.0 - 19773)
  d: 11281440  86507524.2BSD 1024  819216   # (Cyl. 8582*- 19773*)

I recently upgraded the amount of RAM available on this machine
from 128M to 256M, and it took me a while to figure out why
swapon(8) no longer wants to enable swapping on `b' (which is
only 128M large).  I was pretty tired at the moment, and I thought
that maybe the problem is with the contents of my `b' partition,
so I did: dd if=/dev/zero of=/dev/ad0b bs=512 count=1000.  This
did not help, and eventually I recalled the fact of upgrading RAM,
and I've looked into some /sys/kern code to verify my guesses.
Nevertheless, I continued with my work on this machine, and compiled
and installed the new kernel (without any problems) on it.  Next
reboot refused to boot FreeBSD by mentioning that "No operating
system was found".  I wondered how I managed to screw my disk up.
It was too late in the night, so I delayed it until the next morning.
The night and next morning gave me the knowledge about what I did
wrong, and it surprised me a lot, as I never thought about it before.
The disklabel occupies the first sectors of the disk (or slice, if
you are under i386 and have your disk sliced).  My `b' partition
starts from the very first sector of my disk, so when I did the
dd(1) it overwrote the disklabel of my disk with zeroes.  Once
I understood and verified it, I recovered from this very fast.
I remembered that my swap partition was first and exactly 128M
large, so I skipped over this space, and saved some amount of
my `a' partition into a plain file.  Fortunately, file(1) is
smart enough to read the superblock and tell you about the
size of the filesystems.  This way I found the size of my
`a' partition and an offset for my `d' partition.  Hope this
technique could help someone in a similar situation.  Now the
question.  Where is the code in the kernel that prevents swapping
and/or writing to a disklabel portion of a physically first
partition on the disk?


Thanks,
-- 
Ruslan Ermilov  Sysadmin and DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]   FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age


pgp0.pgp
Description: PGP signature
--- End Message ---


pgp1.pgp
Description: PGP signature


KVA suggestions on 4gig+2gig memory system ?

2003-04-05 Thread Josh Brooks

Hello,

I have a new system that has 4gigs of physical memory ... and I am
concerned about running into problems due to running out of KVM.

I am running FreeBSD 4.8, and in addition to 4gigs of ram, I have
configured 2gigs of swap space.  The system does not swap much at all, but
I need it there just in case.

I will be upping shm as follows for database use:

options SHMSEG=256
options SEMMNI=384
options SEMMNU=256
options SEMMAP=256
options SEMMNS=512
options SHMMAXPGS=12288
options SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)"

and the system will be used as a large multiuser system with a lot of
different processes running (1200-1600 processes)

So my questions are:

1. Should I change the default value of KVA_PAGES ?  I have another system
running the same processes and same load as this one, and it does not
specify any KVA_PAGES in the kernel config, so it is using the default
value - and it works wonderfully.  BUT, this other system has 3 physical +
2 swap, and not 4 physical.  So will that extra gig of physical demand
altering KVA_PAGES ?

2. If I should change it, suggestions ?  The default is 260, and I believe
512 splits memory in half ... perhaps 512 is a good number ?

3. are there any other tunables to worry about ?


I think the key here is that I am running wonderfully on the 3+2 system
without any tunings for KVA, so I am just looking for advice on what the
extra gig of physical does for me...it may be useful to mention that the
original 3+2 system has 40% swap usage ... but maybe that doesn't matter.

thanks!

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


kernel device dependency and sys/conf/files format

2003-04-05 Thread Geoffrey C. Speicher
I'm revisiting the project to determine device dependency in the kernel,
and I've run into a situation where net/if.c requires the ether device,
but no device appears to require net/if.c directly.

sys/conf/files says that net/if.c is "standard", but I have no idea what
that means in terms of building a kernel.  An entry (filename) in that
file can be listed as standard, mandatory, optional, or count.  Mandatory
and optional seem pretty self-explanatory, but can anyone explain the
meaning of standard and count?

I assume that net/if.c can be removed from the build or else it would be
listed as mandatory, but it does appear that an awful lot of things
implicitly depend on it.

Geoff

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


-CURRENT/Integer Divide Exception/CBB related

2003-04-05 Thread Larry Rosenman
Can I get someone to look at the post I made to the -CURRENT list yesterday 
with a random
Integer Divide Exception I get when my Wireless card is active?

I have a Panic Dump available.

This is a -CURRENT installed Thursday night from 5.0-RELEASE media, same 
issue on 5.0-RELEASE.

Updated sources from the 4.8-RC installed as a Dual-Boot, and the same 
EXACT hardware
runs fine under 4.8-RC from thursday.

I'm willing to make whatever I can available.

LER

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: /bin/sh and BIG NUMBERS

2003-04-05 Thread Giorgos Keramidas
On 2003-04-05 07:06, Alex Semenyaka <[EMAIL PROTECTED]> wrote:
> I found that /bin/sh cannot handle numbers those do not fit to integer
> type.  That is not too bad. Too bad that it just silently warps them
> in arithmetical operations:
>
> [EMAIL PROTECTED]> /bin/sh -c 'echo $((100-1))'
> 2147483646
>
> That was not a problem 5 years ago... But now we have a lot of 64-bits
> values.  So those old scripts which perfectly worked for a long time
> now can give wrong results, and you will not be able even to notice
> it, there is no any diagnostics or such. The simplest way to fix it is
> to switch internal /bin/sh arithmetics from 32 to 64-bits (you know,
> approach "640K ought to be enough for anybody").  I've did the patch
> for this (below), please, look at it. Any comments or suggestions?
>
> diff -u -U1 -r ../sh.old/arith.h ./arith.h
> --- ../sh.old/arith.h Fri Jul 19 08:38:51 2002
> +++ ./arith.h Sat Apr  5 06:26:48 2003
> @@ -36,3 +36,3 @@
>
> -int arith(char *);
> +long long arith(char *);
>  int expcmd(int , char **);
>
> [snip rest of long-long using patch]

Nice idea, but we should probably ask the -standards people if we
can/should make this use uint64_t and %jd instead of `long long'
(using %qd is deprecated and %lld is advised in printf(3) anyway).

: [EMAIL PROTECTED]:19]/tmp/lala$ cat lala.c
: #include 
: #include 
: #include 
:
: int
: main(void)
: {
: uint64_t foo;
:
: foo = UINT_MAX;
: printf("%jd\n", foo);
: return (0);
: }
: [EMAIL PROTECTED]:19]/tmp/lala$ make WARNS=5
: Warning: Object directory not changed from original /tmp/lala
: cc -O -pipe   -Wsystem-headers -Werror -Wall -Wno-format-y2k \
:  -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
:  -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow \
:  -Wcast-align -Wuninitialized -Wformat=2 -Wno-format-extra-args \
:  -Werror  -c lala.c
: cc -O -pipe   -Wsystem-headers -Werror -Wall -Wno-format-y2k \
:  -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
:  -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow \
:  -Wcast-align -Wuninitialized -Wformat=2 -Wno-format-extra-args \
:  -Werror   -o lala lala.o
: [EMAIL PROTECTED]:19]/tmp/lala$ ./lala
: 4294967295
: [EMAIL PROTECTED]:19]/tmp/lala$

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: the CPU interrupt handler

2003-04-05 Thread Kan Cai


On Fri, 4 Apr 2003, Terry Lambert wrote:

> Kan Cai wrote:
> >   I am trying to locate the CPU interrupt handler, but with no luck. I
> > guess it is somewhere in the "1386" folder, but not sure which file is
> > doing the job. Could someone there shed some lights on this?
> >
> >   Since I am trying to capture the NIC interrupts, so it should not be
> > exceptions. Thanks a lot.
>
> You need to look at an existing NIC driver to see how it
> grabs interrupts.  The functions you are probably interested
> in are bus_setup_intr() and bus_teardown_intr().
>
> If you are trying to do this in an evil, i386 way, because you
> want to intercept the interrupt path for some legitimate
> instrumentation purpose, or because you have some wrong idea
> that this will make your networking product run faster, then
> you could do worse than to look at the functions "inthand_*"
> in /usr/src/sys/i386/isa/intr_machdep.c.

Thanks a lot for this info, but I guess I didn't express myself clearly.
The real goal of mine is to insert a timer into where the processor
gets interrupted, switches the context, and finally calls the
corresponding handlers.

After reading the intr_machdept.c, I am kinda doubt that it is the right
file I should focus, it mainly does the setup and remove entries in GDT
and IDT, doesn't it? I found that in "apic_vector.s", there is a function
called "INTR", is that true that I should put my timer in this function?

Any related info is highly appreciated.

Cheers,
ken

>
> -- Terry
>
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"