Re: FreeBSD fdisk how to?

2008-06-21 Thread Nejc Škoberne

Hi,


Well, fdisk(8) is somewhat cumbersome to use.  Personally I tend to invoke
sysinstall(8) to create new slices (can be done after install too.)  Much
easier to use.


OT, but: does sysinstall's fdisk also support gmirror and gstripe devices?
Or do I need to use fdisk to make slices there?

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


Re: FreeBSD fdisk how to?

2008-06-21 Thread Roland Smith
On Sat, Jun 21, 2008 at 11:26:01AM +0200, Nejc Škoberne wrote:
 Hi,
 
  Well, fdisk(8) is somewhat cumbersome to use.  Personally I tend to invoke
  sysinstall(8) to create new slices (can be done after install too.)  Much
  easier to use.
 
 OT, but: does sysinstall's fdisk also support gmirror and gstripe devices?

No

 Or do I need to use fdisk to make slices there?

Yes. But it is not hard.

First of all: _make backups_ !

To create this mirror configuration, the machine is booted from a CD
which contains a live filesystem. I used the
7.0-RELEASE-amd64-livefs.iso image to create this CD. After the machine
boots, the sysinstall(8) application is started automatically. In the
first two menus you have to set your location and keyboard type. The
location doesn't really matter since we won't be installing anything. It
is probably best to choose the default keyboard layout, unless you know
otherwise. Next the ``Fixit'' option is chosen, followed by the
``CDROM/DVD'' option in the next menu. We are now in the shell of the
livefs. The first order of business is to check if the disks have been
recognized. The command

# ls /dev/ad*

should return two disks. 
Now it is time to create a mirrored device using
the gmirror(8) tool. Next the mirror is activated by loading the
geom_mirror kernel module. After the kernel module has been
loaded, the mirrored device \texttt/dev/mirror/gm0 should appear.

# gmirror label gm0 ad4 ad6
# kldload /mnt2/boot/kernel/geom_mirror.ko


Now it is time to devide the disks into slices (which are called partitions
in PC parlance). The -I option creates one FreeBSD slice covering
the entire disk. The -B option writes a boot block.

# fdisk -vBI /dev/ad4
# fdisk -vBI /dev/ad6

Now that the disk has been given a single slice, a new device
/dev/mirror/gm0s1 will appear. We will now subdivide that into
FreeBSD partitions using bsdlabel(8). First we will write a standard
label and boot blocks. 

# bsdlabel -wB /dev/mirror/gm0s1
# export EDITOR=/mnt2/usr/bin/ee
# bsdlabel -e /dev/mirror/gm0s1

The command in the middle sets the editor to something more user friendly
then vi! The last command will open a text editor with the
partition table that the first command made. It should be edited to look
like the following (for example);

# /dev/mirror/gm0s1:
8 partitions:
#  size  offset  fstype  [fsize bsize]
a: 500M  16  4.2BSD  2048 16384  # /
b: 8G*   swap# Reserved for swap.
c: * *   unused  00  # raw part.
d: 2G*   4.2BSD   2048 16384 # /var
e: 50G   *   4.2BSD   2048 16384 # /tmp
f: 20G   *   4.2BSD   2048 16384 # /usr
g: * *   4.2BSD   2048 16384 # /home

The disk partitions are now ready to put the filesystems on them. To
minimize the chance of problems with the root partition, softupdates are
not enabled for root.

# newfs /dev/mirror/gm0s1a
# newfs -U /dev/mirror/gm0s1d
# newfs -U /dev/mirror/gm0s1e
# newfs -U /dev/mirror/gm0s1f
# newfs -U /dev/mirror/gm0s1g

Now you can restore your backups.

Before you reboot, edit /etc/fstab to mount the right partitions.

And edit /boot/loader.conf to load the geom_mirror module.

# echo 'geom_mirror_load=YES' /boot/loader.conf

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpTdcK5Wkl9s.pgp
Description: PGP signature


FreeBSD fdisk how to?

2008-06-20 Thread Unga
Hi all

I need to partition a new 250GB SATA disk.

BIOS Auto calculated disk geometry shows:
parameters extracted from in-core disklabel are:
cylinders=119706 heads=16 sectors/track=255 (4080 blks/cyl)

That is, Total sectors=488400480

Since the C/H/S values are not compatible with FreeBSD fdisk, I recalculated 
them as:
Sectors/track: 63
Heads: 255

Cylinders = 488400480 / 16065
  = 30401


I made a configfile as:
g c30401 h255 s63
p 1 165 63 488392002
a 1


I ran fdisk as follows:
fdisk -f configfile -itv /dev/ad2


I get following message:

*** Working on device /dev/ad2 ***
fdisk: invalid fdisk partition table found
fdisk: WARNING line 1: number of cylinders (30401) may be out-of-range
(must be within 1-1024 for normal BIOS operation, unless the entire disk
is dedicated to FreeBSD)
parameters extracted from in-core disklabel are:
cylinders=119705 heads=16 sectors/track=255 (4080 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=30401 heads=255 sectors/track=63 (16065 blks/cyl)

Information from DOS bootblock is:
1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 488392002 (238472 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 704/ head 254/ sector 63
2: UNUSED
3: UNUSED
4: UNUSED


Now my questions:

1. Am I suppose to enter as c1024 instead of c30401, irrespective of the size 
of the disk?

2. Is it an error if I still enter as c30401?

3. Am I suppose to enter the c30401 h255 s63 values to the BIOS as user mode 
before run fdisk?

In case the way I use fdisk under FreeBSD is not correct, appreciate if you 
guys can point to some documentation. I followed the fdisk(8).

Many thanks in advance.

Kind regards
Unga


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


Re: FreeBSD fdisk how to?

2008-06-20 Thread Wojciech Puchar

g c30401 h255 s63
p 1 165 63 488392002
a 1


I ran fdisk as follows:
fdisk -f configfile -itv /dev/ad2



is this disk FreeBSD only? don't use fdisk at all
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: FreeBSD fdisk how to?

2008-06-20 Thread Unga
--- On Fri, 6/20/08, Wojciech Puchar [EMAIL PROTECTED] wrote:

 From: Wojciech Puchar [EMAIL PROTECTED]
 Subject: Re: FreeBSD fdisk how to?
 To: Unga [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Date: Friday, June 20, 2008, 3:57 PM
  g c30401 h255 s63
  p 1 165 63 488392002
  a 1
 
 
  I ran fdisk as follows:
  fdisk -f configfile -itv /dev/ad2
 
 
 is this disk FreeBSD only? don't use fdisk at all

Yep this hard disk is for FreeBSD only. Why I should not use fdisk? What should 
I use to partition a disk? I'm running FreeBSD 7.0.

Regards
Unga


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


Re: FreeBSD fdisk how to?

2008-06-20 Thread Wojciech Puchar


Yep this hard disk is for FreeBSD only. Why I should not use fdisk?


because it's not needed.





clean it up
dd if=/dev/zero of=/dev/disk bs=64k count=1

make initial label

bsdlabel -w disk

edit label to your needs

bsdlabel -e disk

newfs,mount,copy files,umount

bsdlabel -B disk
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: FreeBSD fdisk how to?

2008-06-20 Thread Unga
--- On Fri, 6/20/08, Wojciech Puchar [EMAIL PROTECTED] wrote:

 From: Wojciech Puchar [EMAIL PROTECTED]
 Subject: Re: FreeBSD fdisk how to?
 To: Unga [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Date: Friday, June 20, 2008, 5:18 PM
 
  Yep this hard disk is for FreeBSD only. Why I should
 not use fdisk?
 
 because it's not needed.
 
 
 
 clean it up
 dd if=/dev/zero of=/dev/disk bs=64k count=1
 
 make initial label
 
 bsdlabel -w disk
 
 edit label to your needs
 
 bsdlabel -e disk
 
 newfs,mount,copy files,umount
 
 bsdlabel -B disk

But this does not create slices, does it? How to create multiple slices?

Regards
Unga



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


Re: FreeBSD fdisk how to?

2008-06-20 Thread Wojciech Puchar


newfs,mount,copy files,umount

bsdlabel -B disk


But this does not create slices, does it?


yes. because slices are not needed if you want freebsd-only disk - that's 
why i asked for.



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


Re: FreeBSD fdisk how to?

2008-06-20 Thread Unga
--- On Fri, 6/20/08, Wojciech Puchar [EMAIL PROTECTED] wrote:

 From: Wojciech Puchar [EMAIL PROTECTED]
 Subject: Re: FreeBSD fdisk how to?
 To: Unga [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Date: Friday, June 20, 2008, 6:32 PM
 
  newfs,mount,copy files,umount
 
  bsdlabel -B disk
 
  But this does not create slices, does it?
 
 yes. because slices are not needed if you want freebsd-only
 disk - that's 
 why i asked for.

IC, sorry may be I did not make myself clear enough then. The fdisk statement I 
ran only with one partition entry is to learn fdisk, that's why I ran in test 
mode.

I need at least 2 partitions, one for FreeBSD 7 and other for FreeBSD 8. I need 
two slices for that.

I still need to understand clearly how to create slices in FreeBSD. I know 4 
slices per disk can be created.

The question is, is what I posted on my first post sufficient to create slices 
correctly? 

Btw, thank you very much for so many replies without giving up :)

Unga





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


Re: FreeBSD fdisk how to?

2008-06-20 Thread Erik Trulsson
On Fri, Jun 20, 2008 at 03:44:59AM -0700, Unga wrote:
 --- On Fri, 6/20/08, Wojciech Puchar [EMAIL PROTECTED] wrote:
 
  From: Wojciech Puchar [EMAIL PROTECTED]
  Subject: Re: FreeBSD fdisk how to?
  To: Unga [EMAIL PROTECTED]
  Cc: freebsd-questions@freebsd.org
  Date: Friday, June 20, 2008, 6:32 PM
  
   newfs,mount,copy files,umount
  
   bsdlabel -B disk
  
   But this does not create slices, does it?
  
  yes. because slices are not needed if you want freebsd-only
  disk - that's 
  why i asked for.
 
 IC, sorry may be I did not make myself clear enough then. The fdisk statement 
 I ran only with one partition entry is to learn fdisk, that's why I ran in 
 test mode.
 
 I need at least 2 partitions, one for FreeBSD 7 and other for FreeBSD 8. I 
 need two slices for that.
 
 I still need to understand clearly how to create slices in FreeBSD. I know 4 
 slices per disk can be created.
 
 The question is, is what I posted on my first post sufficient to create 
 slices correctly? 
 
 Btw, thank you very much for so many replies without giving up :)
 

Well, fdisk(8) is somewhat cumbersome to use.  Personally I tend to invoke
sysinstall(8) to create new slices (can be done after install too.)  Much
easier to use.
Also, you can almost always ignore any warnings about the geometry of the
disk.  Once the kernel has booted FreeBSD does not make use of the geometry
anyway, so it is only if you need to boot from the disk or if you use the
disk from some other OS that it might matter (but it usually works just fine
without any adjustments.)



-- 
Insert your favourite quote here.
Erik Trulsson
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: FreeBSD fdisk how to?

2008-06-20 Thread Jerry McAllister
On Fri, Jun 20, 2008 at 01:48:44AM -0700, Unga wrote:

 --- On Fri, 6/20/08, Wojciech Puchar [EMAIL PROTECTED] wrote:
 
  From: Wojciech Puchar [EMAIL PROTECTED]
  Subject: Re: FreeBSD fdisk how to?
  To: Unga [EMAIL PROTECTED]
  Cc: freebsd-questions@freebsd.org
  Date: Friday, June 20, 2008, 3:57 PM
   g c30401 h255 s63
   p 1 165 63 488392002
   a 1
  
  
   I ran fdisk as follows:
   fdisk -f configfile -itv /dev/ad2
  
  
  is this disk FreeBSD only? don't use fdisk at all
 
 Yep this hard disk is for FreeBSD only. Why I should not use fdisk? What 
 should I use to partition a disk? I'm running FreeBSD 7.0.

He is making what was popularly called a 'dangerously dedicated' disk.
There are no slices, just partitions carved out of the raw disk.  It is
readable only by FreeBSD.
It works, but I prefer to have the flexibility of using fdisk and 
creating slices and then dividing them in to partitions.

jerry


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