DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Installation and Upgrading

FreeBSD Installation and Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default FreeBSD 8.0 and RAID-1

Hello,

A couple of days ago I've sent an email to the lists@, about my issues, but couldn't get a decent solution about my problem. So, here I am asking for some ideas

This is the situation - I want to create a RAID-1 for my FreeBSD 8.0 system.
For that you may say there are already existing tools like:
  • gmirror
  • gvinum
  • gconcat
  • et cetera, and all the other geom tools

From my testings for about 2-3 days now with the new 8.0 RELEASE, I can say that none of the above can do what I need, and that is - Creating a mirror for all the partitions - /var, /tmp, / , swap, /usr and also keeping the possibility to extend these partitions if needed.

Well, that functionality is already present in gvinum, but unfortunately 8.0, doesn't allow you to manipulate the disks, like it was in 7.2 for example.

What I mean is this - in 7.2 you can make a fresh minimal install and then transform all of your partitions to gvinum volumes - now using gpart that is not possible, because you cannot create one big vinum partition that overlaps the others.

Yes, sure I can use gmirror to mirror the partitions, but I cannot extend them if I need one day - using gvinum it's fairly simple - you just add new subdisks to the existing plexes, but the issue remains - you cannot transform the partitions to gvinum volumes in 8.0

Are you guys using a software RAID for your systems? How did you do it? I'm open to any ideas.

Thanks and regards,
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
  #2   (View Single Post)  
Old 3rd December 2009
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,062
Thanked 198 Times in 156 Posts
Default

Can't ZFS do that? I haven't really worked with it, but I think it can.
Maybe someone can confirm that or tell me I'm talking nonsense...

Sorry for not being more helpful I don't have the time to look it up right now.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 4th December 2009
vermaden's Avatar
vermaden vermaden is online now
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,052
Thanked 118 Times in 93 Posts
Default

Quote:
Originally Posted by DNAeon View Post
  • gmirror
  • gvinum
  • gconcat
The gconcat does not provide mirroring, it only creates big logical space from all disks available, like raid0, but without performance gains.

Generally gmirror is currently preferred sollution instead of gvinum.

@Carpetsmoker
This should do the job:
# zpool create POOL mirror DISK0 DISK1
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd
Reply With Quote
  #4   (View Single Post)  
Old 4th December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Quote:
Originally Posted by vermaden View Post
The gconcat does not provide mirroring, it only creates big logical space from all disks available, like raid0, but without performance gains.

Generally gmirror is currently preferred sollution instead of gvinum.

@Carpetsmoker
This should do the job:
# zpool create POOL mirror DISK0 DISK1
Hello,

Thanks for the replies!

Yes, I know that gconcat doesn't provide mirroring, but it was also part of the problem - I've tried concatenating several slices and then mirror them using gmirror, but that doesn't work out I wanted to have the option to extend the volumes, once I mirror them.

ZFS sounds good, but I don't think it would be of any good for my system - it's an IBM ThinkCentre A50 with 1g of RAM and 2.53GHz CPU. May if I add it 1 or 2 more gigs of RAM it would be reasonable to run ZFS. What do you think? (Please people having experience with ZFS - share your ideas )

Also, if I run ZFS will I be able to extend the volumes after mirroring them - I really want to have that option since it's more likely that new disk(s) will be added to the system.

Thanks and regards,
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
  #5   (View Single Post)  
Old 4th December 2009
gkontos's Avatar
gkontos gkontos is offline
Real Name: George
Port Guard
 
Join Date: May 2008
Location: Greece
Posts: 41
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by DNAeon View Post
Also, if I run ZFS will I be able to extend the volumes after mirroring them - I really want to have that option since it's more likely that new disk(s) will be added to the system.

Thanks and regards,
DNAeon
With ZFS you can expand the volumes very easy. There is a nice article here. In your case though you would have to create a ZFS root install. This is something that I'm currently "playing around" in vmware.

George
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
  #6   (View Single Post)  
Old 4th December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Quote:
Originally Posted by gkontos View Post
With ZFS you can expand the volumes very easy. There is a nice article here. In your case though you would have to create a ZFS root install. This is something that I'm currently "playing around" in vmware.

George
Thanks for the link! A nice howto

It's really so easy to extend the volumes, wow!

I'm also thinking about the following situation, though.. Will ZFS allow me to use slices instead of whole disks - that way I would be able to mirror disks that are not identical.

I have two disks - one 250g and one 750g. So instead of getting identical disks I slice the second one into two - one 250g and one 500g slices. The first slice of the bigger one is used to mirror the first disk, and rest 500g are used for some data that is not that important.

I was able to do this using gmirror in single-user mode, but don't know if ZFS would allow me to do this? Have you tried this?

Thanks!
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
  #7   (View Single Post)  
Old 4th December 2009
gkontos's Avatar
gkontos gkontos is offline
Real Name: George
Port Guard
 
Join Date: May 2008
Location: Greece
Posts: 41
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by DNAeon View Post
Thanks for the link! A nice howto
I have two disks - one 250g and one 750g. So instead of getting identical disks I slice the second one into two - one 250g and one 500g slices. The first slice of the bigger one is used to mirror the first disk, and rest 500g are used for some data that is not that important.

I was able to do this using gmirror in single-user mode, but don't know if ZFS would allow me to do this? Have you tried this?

Thanks!
As far as I'm aware:
Code:
# zpool create myzfs mirror /disk1 /disk4
invalid vdev specification
use '-f' to override the following errors:
mirror contains devices of different sizes
It will only use the space of the smallest size. I don't know of any other way for slicing them, sorry
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
  #8   (View Single Post)  
Old 4th December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Quote:
Originally Posted by gkontos View Post
As far as I'm aware:
Code:
# zpool create myzfs mirror /disk1 /disk4
invalid vdev specification
use '-f' to override the following errors:
mirror contains devices of different sizes
It will only use the space of the smallest size. I don't know of any other way for slicing them, sorry
Hi,

Probably I didn't explain myself better

This is what I mean about the slices - I've tested this under VirtualBox and works.

I have two disks - 10g (ad0) and 15g (ad4). On the 1st disk I create one slice (ad0s1), the second I don't touch for the moment, and then make a minimal install.

After booting into the newly installed system I have this:
Code:
# gpart show
=>      63  20971440  ad0  MBR  (10G)
        63  20971377    1  freebsd  [active]  (10G)
  20971440        63       - free -  (32K)

=>       0  20971377  ad0s1  BSD  (10G)
         0   2097152      1  freebsd-ufs  (1.0G)
   2097152   2097152      4  freebsd-ufs  (1.0G)
   4194304   2097152      2  freebsd-swap  (1.0G)
   6291456   2097152      5  freebsd-ufs  (1.0G)
   8388608   8388608      6  freebsd-ufs  (4.0G)
  16777216   4194161      7  freebsd-ufs  (2.0G)
Then the trick is to create a slice on the second disk (ad4s1) with the size of the root partition on the first disk (ad0s1a = 2097152 = 1g)
Code:
# gpart create -s mbr ad4
# gpart add -t freebsd ad4
# gpart set -a active -i 1 ad4
# gpart add -s 2097152 -t freebsd-ufs ad4s1
And the result of gpart is like this now:
Code:
# gpart show
=>      63  20971440  ad0  MBR  (10G)
        63  20971377    1  freebsd  [active]  (10G)
  20971440        63       - free -  (32K)

=>       0  20971377  ad0s1  BSD  (10G)
         0   2097152      1  freebsd-ufs  (1.0G)
   2097152   2097152      4  freebsd-ufs  (1.0G)
   4194304   2097152      2  freebsd-swap  (1.0G)
   6291456   2097152      5  freebsd-ufs  (1.0G)
   8388608   8388608      6  freebsd-ufs  (4.0G)
  16777216   4194161      7  freebsd-ufs  (2.0G)

=>      63  33554367  ad4  MBR  (16G)
        63  33554367    1  freebsd  [active]  (16G)

=>       0  33554367  ad4s1  BSD  (16G)
         0   2097152      1  freebsd-ufs  (1.0G)
   2097152  31457215         - free -  (15G)
In red are the root partitions on the two disks. Now creating a filesystem and mirroring is easy (these steps are done in single-user mode):
Code:
# newfs -O2 /dev/ad4s1
# gmirror label -vb round-robin gm0 /dev/ad0s1a
# gmirror insert gm0 /dev/ad4s1a
# gmirror status
          Name    Status          Components
mirror/gm0      DEGRADED          ad0s1a
                                  ad4s1a (4%)
Then adding geom_mirror_load="YES" to /boot/loader.conf and changing the fstab entry.

And basically this is how I make a mirror for the root partition using two NOT identical disks - just slicing the disks with an equal sizes and then mirroring. Since both slices are the same size mirroring works

Of course I'm not sure if this can work out with ZFS, but as soon as I get to know with it better I'm going to try it

Regards,
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
  #9   (View Single Post)  
Old 4th December 2009
gkontos's Avatar
gkontos gkontos is offline
Real Name: George
Port Guard
 
Join Date: May 2008
Location: Greece
Posts: 41
Thanked 2 Times in 2 Posts
Default

I see what you mean but I don't know if you can do that with ZFS. I don't think that you can create 2 ZFS slices in a disk from what I've understand so far...

But you could definitely try. Here you can download a very nice image for playing with ZFS root. Excellent work!

Regards,

George
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
Old 4th December 2009
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

ZFS vdevs can be made from files on existing filesystems (only useful for testing), disk partitions (/dev/ad0s1d for example), disk slices (/dev/ad0s1 for example), or whole disks (/dev/ad0 for example). In fact, anything that you can create or access with GEOM, can be used to create ZFS vdevs.

However, to get all the benefits of ZFS, it should be used with whole disks.

To make things simple, as well, you should use glabel to label the disks/slices/partitions, and then reference the labels when creating the vdevs (zpool create storage mirror label/disk0slice0 label/disk1slice0, for example). That way, if you change disks, or change controllers, or whatever, ZFS will continue to work right away, without any manual intervention to get the device names sync'd.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Old 4th December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Thanked 6 Times in 6 Posts
Default

Hi,

Thanks a lot for that information, phoenix!

I'll surely try to implement this on my system (as soon as I get more RAM, cause I think ZFS will need it ).

I'll keep you informed about it's progress

Thanks!
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote
Old 6th December 2009
gkontos's Avatar
gkontos gkontos is offline
Real Name: George
Port Guard
 
Join Date: May 2008
Location: Greece
Posts: 41
Thanked 2 Times in 2 Posts
Default

Phoenix, I see your point with glabel!

I was wondering if fsck has any meaning yet on a ZFS root installation

Thanks,

George
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
Reply With Quote
Old 7th December 2009
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 699
Thanked 90 Times in 81 Posts
Default

No. ZFS has features that provide the same end results as "fsck", but without a separate fsck binary.

For example, you can run zpool scrub <poolname> to run a background process that will double-check the data in the pool, using the checksums that are stored in the pool. If there are any mis-matched checksums, the data is recreated from redundant data stored in the pool. This is similar in function to a "background fsck" except that is can actual repair bad data.

In newer versions of ZFS, if there's an issue that prevents the pool from being imported, you are given the option to roll-back one transaction group, which gets you back to a known-good status. (Previously, one had to do this manually using zdb and other arcane "magic" commands. This is not yet in FreeBSD's port of ZFS.)

Thus, you get a working pool, with known-good data, without ever having a separate "fsck" binary. Which is better, since fsck just checks the filesystem metadata, and never checks/fixes the actual file data. Something that ZFS does!!
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Old 7th December 2009
gkontos's Avatar
gkontos gkontos is offline
Real Name: George
Port Guard
 
Join Date: May 2008
Location: Greece
Posts: 41
Thanked 2 Times in 2 Posts
Default

Thanks Phoenix for the info! Actually I have used the "scrub" in my opensolaris box and it is very impressive how fast it works on 2X250 GB drives with 50% utilization and running heavy disk I/O apps during.

Now you mentioned earlier that:
Quote:
To make things simple, as well, you should use glabel to label the disks/slices/partitions, and then reference the labels when creating the vdevs (zpool create storage mirror label/disk0slice0 label/disk1slice0, for example). That way, if you change disks, or change controllers, or whatever, ZFS will continue to work right away, without any manual intervention to get the device names sync'd.
I am currently experimenting in a ZFS boot environment with FreeBSD 8.0 in Vmware server. My question is mainly regarding the mount points. In Opensolaris the system is configured like this:
Code:
gkontos@hp:~# cat /etc/vfstab 
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
/devices        -               /devices        devfs   -       no      -
/proc           -               /proc           proc    -       no      -
ctfs            -               /system/contract ctfs   -       no      -
objfs           -               /system/object  objfs   -       no      -
sharefs         -               /etc/dfs/sharetab       sharefs -       no      -
fd              -               /dev/fd         fd      -       no      -
swap            -               /tmp            tmpfs   -       yes     -
/dev/zvol/dsk/rpool/swap        -               -               swap    -       no      -
However, I haven't found any way to avoid using a traditional fstab in FreeBSD:
Code:
zfsroot# cat /etc/fstab 
/dev/gpt/swap0                 none                    swap    sw              0       0
/dev/gpt/swap3                 none                    swap    sw              0       0
tank/usr /usr zfs rw 0 0
tank/var /var zfs rw 0 0
tank/tmp /tmp zfs rw 0 0
The problem with that is that every time I issue a command like:
Code:
zfs create tank/usr/ports
I have to specify a mount point as well unlike in OpenSolaris where the similar command would create the directory and mount it.
On the other hand if I issue:
Code:
mkdir /usr/ports
zfs create tank/usr/ports
Seems to overcome the problem. I am sure that I do something wrong!
Your help will be much appreciated

George
__________________
...when you have excluded the impossible, whatever remains, however improbable, must be the truth.
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
Want to convert my server to raid revzalot OpenBSD Installation and Upgrading 2 16th September 2009 07:56 PM
What about FreeBSD's RAID-5? stukov FreeBSD General 3 11th November 2008 09:40 PM
RAID-1 over NFS with fail-over PatrickBaer FreeBSD General 0 12th October 2008 12:03 AM
freebsd 7 sofware raid-5 nimmen FreeBSD Installation and Upgrading 2 23rd May 2008 01:04 PM
RAID 10 on FreeBSD bigb89 FreeBSD General 5 11th May 2008 03:58 AM


All times are GMT. The time now is 10:57 PM.


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