Re: Installing 9.1 without re-partitioning hard drive

2013-03-14 Thread Ben Cottrell
Lee,

Are you using DOS-style or GPT partitions? I'm assuming DOS-style,
and the rest of this email is only correct if that's the case, so
correct me if I'm wrong.

There's actually two partition tables at work here -- the big one,
that lives at the start of the physical disk and divides up the
FreeBSD from the Windows.

Inside the FreeBSD slice (slice, partition, same thing, but just
to be clear, call it a slice) there's going to be *another* partition
table, to divide up the FreeBSD partitions amongst themselves. At a
bare minimum you're going to have two partitions (which are really
sub-partitions at this point), root and swap. Maybe even more.

So it seems to me like, if you can get to the point where the
FreeBSD installer recognizes the slice you've set aside for it, as
its own, then you can let it rewrite the partition table *inside
that slice* as much as it wants to. OK? Make sense?

You just don't want it to touch the *outer* one.

I honestly don't know enough about how the boot blocks work to
know if that's going to work, in the end. You might still end up
having to say yes to let it install FreeBSD boot blocks -- I don't
know.

But it seems to me like a prerequisite, in any case, is going to
be to set the FreeBSD partition to partition type 165, so that
the installer will recognize it as a FreeBSD slice. Is it already
partition type 165? If not, can you make it type 165 and see if
that changes anything?

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


Re: day light saving time happened today

2013-03-10 Thread Ben Cottrell
On Mar 10, 2013, at 10:37, Fbsd8 fb...@a1poweruser.com wrote:
 day light saving time happened early sunday morning and the time shown by the 
 date command is still one hour behind. I just did a clean 9.1 install from 
 cdrom and selected the correct time zone for my location.

The DST change worked fine for me...!

I'm curious what it prints if you run the command:

find /usr/share/zoneinfo -type f -print | xargs md5 | grep `md5 -q 
/etc/localtime`

It used to be that /etc/localtime was, by convention if
nothing else, a symlink so you could easily see what it pointed
to, but not anymore... the above is the easiest way I can think
of to figure out what time zone your system is *really* set to.

Yes, it should have happened automatically. There's no special
setting you have to enable. It should have just worked. So
my suspicion is that your /etc/localtime isn't pointing to
what you think it's pointing to...

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


Re: day light saving time happened today

2013-03-10 Thread Ben Cottrell
On Mar 10, 2013, at 14:50, Fbsd8 fb...@a1poweruser.com wrote:
 # /root find /usr/share/zoneinfo -type f -print | xargs md5 | grep `md5 -q 
 /etc /localtime`
 MD5 (/usr/share/zoneinfo/America/New_York) = e4ca381035a34b7a852184cc0dd89baa

That's really, really odd. I'm confused.

If you run date does it show the time zone as EST or EDT? If you
have python installed, you might also try:

python -c 'import time; print time.localtime().tm_isdst'
(it should be 1)

Is the year correct? I mean, could it be thinking it's some different
year, where the time zone rules are different?

Now *I'm* curious. :-) I've honestly never seen a system do that
before. If you figure it out, I hope you'll let either me, or the
list, know what it was!

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


Re: [Bulk] Re: day light saving time happened today

2013-03-10 Thread Ben Cottrell
On Mar 10, 2013, at 19:18, Fbsd8 fb...@a1poweruser.com wrote:
 What is really needed is for the tzsetup program to state which east coast 
 selections have day light saving included. Maybe a pr is in order.

Nope, you pretty conclusively proved that you're using the right
time zone setting. Trust me. :-) That md5 you posted is the exact
same md5 that's on my own system. My own America/New_York is
doing just fine, thank you. ;-)

Something else is going on. *What*, I don't know. But you chose
the right time zone in tzsetup and that time zone description
file definitely does have DST rules in it.

I never use the wall_cmos_clock setting, because I don't trust
it -- at least with the traditional behavior (wall_cmos_clock=0)
I know *exactly* what's going on. I really don't know what is
happening under the hood when that's turned on, so I have no
idea if it could be related or not. But I'm curious what
it shows if you run:

sysctl machdep.wall_cmos_clock

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


Re: how to forbid a process to use swap?

2013-03-09 Thread Ben Cottrell
On Mar 9, 2013, at 15:55, Anton Shterenlikht me...@bristol.ac.uk wrote:
 I run a program that uses large arrays.
 I don't want it to use swap, because it's
 too slow. I want the program to fail when
 there's not enough RAM, rather than using
 swap. How to do this?

If it were me I would start with mlockall() and work from there...
do you have source code to the program in question?

You could also play with resource limits, just from the shell
(ulimit in sh, limit in csh) -- but that's less of an exact
science, since you don't *know* for sure how much memory the
process will be able to use before swap starts being used.

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


Re: Confused by restore(8) man page example

2013-03-04 Thread Ben Cottrell
On Mar 4, 2013, at 01:47, Ronald F. Guilmette r...@tristatelogic.com wrote:
 All I see is a pre-existing BSD partition being explicitly newfs'ed and
 then mounted, followed by some stuff being restored to that (clean)
 BSD partition from whatever is currently sitting on the tape drive
 called /dev/sa0.
 
 So?  What possible problem could derive from merely that?  I don't see
 any.

I guess the same text in the man page could be read several
different ways! The way I read it (which may or may not be
correct) is that the example given is an example of how to
use it *correctly*. It sounds to me like it's warning against
deviating too far from the steps given in the example.

I can see as how the text might allow other interpretations,
though!

~Ben
(who is always careful to avoid using out-of-range values
 with mktime() when setting up lunch with promptness sticklers
 in Riyadh...)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Fat Fingered An 'rm -rf' of Important Files

2013-02-27 Thread Ben Cottrell
On Feb 27, 2013, at 19:08, Joseph A. Nagy, Jr jnagyjr1...@gmail.com wrote:
 If we can skip the finger wagging on that part I'd appreciate it.

No finger-wagging from this quarter at least!

Something I've sometimes done to retrieve text content is to run a
strings on the disk device (the thing in /dev). You obviously want
to redirect the strings output to someplace that's *not* on the same
filesystem, or it'll be overwriting what you're trying to recover!

It's usually possible, through searching for key words and phrases,
to get back any text content that you know was there.

Sorry! And... good luck!!

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


Re: using AWK

2012-12-17 Thread Ben Cottrell
Hi Jack,

On Dec 17, 2012, at 03:39, Jack Mc Lauren jack.mclau...@yahoo.com wrote:
 How can I read a file which contains a number and assign that number to
 a variable via awk programming? By the way, I want to use this awk program
 in a shell script.

I'm actually not sure what you're asking, exactly -- you want the number
to go into an awk variable? Or a shell variable?

Assuming you want it to go into an awk variable, I would try something
like this:

getline my_number  filename;
close filename;

That assumes the filename is stored in the variable named filename.
It puts the number in the awk variable named my_number.

To put that in context, let's say you're getting the filename from $0,
and you want to multiply the number by 2 and print it. You might do:

filename = $0;
getline my_number  filename;
close filename;
print my_number * 2;

Or if I completely misinterpreted your question, let me know :-)

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


Re: using AWK

2012-12-17 Thread Ben Cottrell
On Dec 17, 2012, at 04:22, Jack Mc Lauren jack.mclau...@yahoo.com wrote:
 This is what i wrote:

OK -- I'm adjusting my assumptions about what you're trying to do. :-)
Bear with me:

 #! /bin/sh
 
 filename=$0

So (a) there's only one input file, not multiple... and (b) it should
come from the command line of the shell script wrapper. Right?

 awk 'getline no  filename; print no'

If there's only one input file, then this is super easy and you
don't even need any of the getline or close stuff. Try:

filename=$1
awk '{no = $0; print no;}' $filename

In the shell script context (outside the awk), $1 refers to the first
command line parameter of the script. You don't want $0 there.

On the other hand, *inside* the awk part, dollar-sign variables have
a completely different meaning. $0 in *awk* (not sh) means the entire
contents of each line of the input file. So if your file had multiple
lines, that block would run multiple times. But since I'm guessing your
file only has one line (that being the number in question), the awk
block will only run once.

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


Different take on old FAQ: multihoming and source-based routing

2012-09-01 Thread Ben Cottrell
Hi everyone,

I've been doing a lot of google searching recently for variants of
freebsd source-based routing to look for how to get a dual-homed
FreeBSD machine to send to the correct default gateway based on the
source address of the packets it's expecting that gateway to pass along.
You can't send a packet with a Comcast source address to the ATT
default gateway and expect it to actually make it out onto the public
internet, etc.

Universally, the posts I've been finding that discuss this always
recommend creating multiple routing tables with options ROUTETABLES=...
which I wasn't willing to do, because my wild youthful kernel-recompiling
days are over -- these days I like the advantages that come with using a
pure GENERIC kernel. :-)

So, today I tried the following /etc/pf.conf:

 if = bge0
 v4_addr_1 = 173.228.91.225
 v4_net_1 = 173.228.91.0/24
 v4_gw_1 = 173.228.91.1
 v4_addr_2 = 50.193.24.82
 v4_net_2 = 50.193.24.80/28
 v4_gw_2 = 50.193.24.94
 
 pass out quick on $if route-to ($if $v4_gw_1) inet from $v4_addr_1 to 
 !$v4_net_1 no state
 pass out quick on $if route-to ($if $v4_gw_2) inet from $v4_addr_2 to 
 !$v4_net_2 no state
 #pass out quick on $if route-to ($if $v6_gw_1) inet6 from $v6_addr_1 to 
 !$v6_net_1 no state
 
 pass all no state

I guess my setup is a bit simpler than the norm because I only have
one physical interface, that both networks are on. But... by Jove,
it seems to be working!

Is there something I'm missing? Is this going to break in some subtle
edge case that I'm just not seeing?

If it really is this simple, why does everyone keep recommending
the options ROUTETABLES approach?

Thanks,

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