View Single Post
  #8   (View Single Post)  
Old 4th December 2009
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
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