# question about fdisk



## wonslung (Jul 6, 2010)

I'm trying to do a remote install of freebsd 8.0.

The machine has 2 hard drives of equal size and i need to get most of it in raid0.
The hosting company doesn't provide raid0 for FreeBSD so i have to do it manually.  I figured the best way to do this would be to use mfsbsd.  I've got mfsbsd loaded and booting, and i can ssh in.  This is where i'm starting to get somewhat confuse.


I'm really not familar with fdisk in FreeBSD, i've always just used sysinstall but i'm fairly sure sysinstall will not create the layouts i need. I have 2 500 gb drives so what i'd like to do is something like:


2 slices, one small one with the rest of the space

make a gmirror on the first slice, this would have /  /tmp  /var /usr and such

then create a raid0 with the second, larger slices which would hold /home


could someone give me a general idea of how to do this without sysinstall?


----------



## wonslung (Jul 6, 2010)

well i ended up going with a gpt setup...i just hope i'm doing it right....

so far, this si what i've done.

Installed mfsbsd, then created these partitions using gpart


```
mfsbsd# gpart show
=>       34  976773101  ad4  GPT  (466G)
         34        128    1  freebsd-boot  (64K)
        162    4194304    2  freebsd-ufs  (2.0G)
    4194466    4194304    3  freebsd-swap  (2.0G)
    8388770   10485760    4  freebsd-ufs  (5.0G)
   18874530    2097152    5  freebsd-ufs  (1.0G)
   20971682   10485760    6  freebsd-ufs  (5.0G)
   31457442  945315693    7  freebsd-ufs  (451G)

=>       34  976773101  ad6  GPT  (466G)
         34        128    1  freebsd-boot  (64K)
        162    4194304    2  freebsd-ufs  (2.0G)
    4194466    4194304    3  freebsd-swap  (2.0G)
    8388770   10485760    4  freebsd-ufs  (5.0G)
   18874530    2097152    5  freebsd-ufs  (1.0G)
   20971682   10485760    6  freebsd-ufs  (5.0G)
   31457442  945315693    7  freebsd-ufs  (451G)
```



then i created the mirrors i want:

```
mfsbsd# gmirror status
           Name    Status  Components
mirror/gm0-root  COMPLETE  ad4p2
                           ad6p2
 mirror/gm0-tmp  COMPLETE  ad4p5
                           ad6p5
 mirror/gm0-var  COMPLETE  ad4p4
                           ad6p4
 mirror/gm0-usr  COMPLETE  ad4p6
                           ad6p6
```


mounted everything on /mnt

used sysinstall to install a system on mount

oh, and i copied the boot stuff to the boot partition on each drive.



Now, the main thing i'm trying to find out, before i reboot, is what configurations stuff i have to set...i don't want to reboot to a non-bootable system....

I know i need to set up /etc/fstab and /etc/rc.conf

And i know i need to set gmirror in /boot/loader.conf but am i missing anything?


----------



## sossego (Jul 6, 2010)

http://forums.freebsd.org/showthread.php?t=12082


----------



## wonslung (Jul 7, 2010)

i actually figured it all out after posting.

It ended up working exactly as i wanted. mfsbsd is truly awesome for remote installs.

one thing that was weird though....i was reading in the handbook that when you create a geom_stripe it should create 2 more items in /dev/stripe/


> Write a standard label, also known as a partition table, on the new volume and install the default bootstrap code:
> 
> # bsdlabel -wB /dev/stripe/st0
> This process should have created two other devices in the /dev/stripe directory in addition to the st0 device. Those include st0a and st0c. At this point a file system may be created on the st0a device with the newfs utility:
> ...




but this was not the case for me......

```
[root@xxxxxx /usr/local/etc]# gstripe status
           Name  Status  Components
stripe/st0-home      UP  ad4p7
                         ad6p7
[root@xxxxxx /usr/local/etc]# ls /dev/stripe/
st0-home
```


```
/dev/stripe/st0-home    873G     44G    759G     6%    /usr/home
```


weird right?


----------



## jem (Jul 7, 2010)

I realise this reply is a bit late now, but if your hosted box is 64-bit and has a decent amount of memory, you might consider setting it up with ZFS mirror.

My own hosted box also has a pair of identical disks, but no hardware or firmware raid.  I have it set up as follows:


```
% gpart show
=>       34  312499933  ad4  GPT  (149G)
         34        128    1  freebsd-boot  (64K)
        162  312499805    2  freebsd-zfs  (149G)

=>       34  312499933  ad6  GPT  (149G)
         34        128    1  freebsd-boot  (64K)
        162  312499805    2  freebsd-zfs  (149G)

% zpool status
  pool: rpool
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            ad4p2   ONLINE       0     0     0
            ad6p2   ONLINE       0     0     0

errors: No known data errors

% zfs list
NAME                                        USED  AVAIL  REFER  MOUNTPOINT
rpool                                      8.45G   138G    19K  none
rpool/ROOT                                 2.77G   138G    18K  none
rpool/ROOT/freebsd                         2.77G   138G  2.52G  legacy
rpool/ROOT/freebsd@install                  182M      -  1.28G  -
rpool/home                                 1.68G   138G    22K  /home
rpool/home/adam                              35K   138G    35K  /home/adam
rpool/home/jason                           1.67G   138G  1.67G  /home/jason
rpool/home/www                             17.1M   138G  17.1M  /home/www
rpool/swap                                    4G   142G    16K  -
```

I used the Root On ZFS guide from the FreeBSD wiki to guide me in setting this up, although I chose a different hierarchy for my zfs filesystems, as there are drawbacks to the authors suggestion.


----------



## wonslung (Jul 7, 2010)

ZFS is wondering, and i love it but for this box it would be terrible.


It's got 2 gb ram and is used as a seedbox.


----------



## jem (Jul 8, 2010)

My dedicated host also only has 2GB RAM, but doesn't do a massive amount of I/O.


----------

