ZFS on Slice or Partition - Help

I'm in way over my head. I just want to throw that out there before I begin.
The task I wish to accomplish is to share a single disk and have part of it be the FreeBSD UFS file system, another part FreeBSD Swap, and the rest be a ZFS pool.

Here is what I have so far:
Code:
# ls /dev | grep amrd0

amrd0
amrd0s1
amrd0s1a
amrd0s1b
amrd0s1c
Code:
# cat /etc/fstab

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/amrd0s1b           none            swap    sw              0       0
/dev/amrd0s1a           /               ufs     rw              1       1
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
Code:
# df -h

Filesystem       Size    Used   Avail Capacity  Mounted on
/dev/amrd0s1a     19G    4.1G     14G    23%    /
devfs            1.0K    1.0K      0B   100%    /dev
Code:
# top | grep Swap
Swap: 8192M Total, 8192M Free
Code:
# fdisk

******* Working on device /dev/amrd0 *******
parameters extracted from in-core disklabel are:
cylinders=88750 heads=255 sectors/track=63 (16065 blks/cyl)

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

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 1425768687 (696176 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
I thought all i would have to do is:
Code:
# zpool create tank amrd0s1c

cannot create 'tank': permission denied
I logged in to single user mode and tried it there and got the same "permission denied" message.

Another guess of mine is that it need to shrink the "amrd0s1" to only what "/" and Swap are using (28GB) and create an "amrd0s2" and do:
Code:
# zpool create tank amrd0s2
But I don't know how to do that.

I've googled like crazy and now have a pounding headache. If someone could help me out that would be amazing.
Thank you for your time.
-Cody
 
Well, first off, you definitely don't want to be using the "c" partition for that. That partition represents the whole slice more likely than not the message is just a friendly warning not to do that.

You don't necessarily need to redo the entire disk layout, just repartition the slice to make sure that you have enough space for the extra ZFS partition. And if I'm reading your post correctly, you just need to fire up sade and add the extra partition into the slice. as it appears that you have a large amount of disk space not really accounted for.

The ultimate command will probably be more like:
Code:
zpool create tank amrd0s1d
Or whatever the extra partition ends up being lettered.
 
Hedwards,
Thank you for your reply.
I was totally unaware that sade existed. Now when I create the new slice it's probably going to ask me the mount point and the FS type. Right? the sysid for freebsd is 165. What should I put in for it in sade?

Thanks again,
Cody
 
I did some googling / experimenting.
I found out that a slice doesn't need the FS type.
I also found out that I should use a bogus mount point like "/fake".
I then need to select the new slice and press "m" and delete the mount point.
Then press "w" and the hit "OK" to write the changes.
After doing that here is what the screen looks like:
Code:
Disk: amrd0     Partition name: amrd0s1 Free: 0 blocks (0MB)

Part      Mount          Size Newfs   Part      Mount          Size Newfs
----      -----          ---- -----   ----      -----          ---- -----
amrd0s1b  swap         8192MB SWAP
amrd0s1a  <none>      20480MB *
amrd0s1d  <none>        651GB *

The following commands are valid here (upper or lower case):
C = Create        D = Delete   M = Mount pt.            W = Write
N = Newfs Opts    Q = Finish   S = Toggle SoftUpdates   Z = Custom Newfs
T = Toggle Newfs  U = Undo     A = Auto Defaults        R = Delete+Merge

Use F1 or ? to get more help, arrow keys to select.
But when I try and do the write I get:
Code:
┌───────────────── Message ──────────────────┐
│ERROR: Unable to write data to disk amrd0!  │
├────────────────────────────────────(100%)──┤
│                [  OK  ]                    │
└──────────[ Press enter or space ]──────────┘
I'm remote right now so I can't boot in single user mode. But I can try that tonight. But other than that Any suggestions?
Thank you,
Cody
 
GEOM, the disk management system in FreeBSD, prevents you from editing the partition table or bsdlabel (slices or partitions) while any of the disks/partitions are mounted.

You either have to boot to single-user mode and not have any partitions on that disk mounted, or use a LiveCD like the FreeBSD LiveFS CD or Frenzy or FreeSBIE.

Or, you can set a sysctl that tells GEOM that you really want to do this:
# sysctl kern.geom.debugflags=16.

Note, however, that you can create an unbootable system if you mess things up. ;)

Quick correction on your terminology:
  • slice is a like a DOS-style primary partition, it's what slices up a disk into smaller portions. You can have up to 4 slices on a disk. These show up as the s numbers in device names (ad0s1 or ad0s2 etc).
  • partition is a section of a slice. You can have up to 8 partitions inside of a slice (a through h, although I believe this has been expanded recently). These show up as the letters at the end of a device name (ad0s1a or ad0s1b etc).

Filesystems go on partitions. Partitions are inside slices. Slices are inside of disks.

In your setup, you want to create a new partition in the bsdlabel. This will show up as ad0s1d, in your case. Doesn't matter if you format it or give it a mountpoint. After it's created, you will unmount it, and just use the raw partition for zfs: zpool create <poolname> ad0s1d

In the future, if you ever re-install, I'd recommend creating two separate slices. Then partition slice 1 up as needed for your UFS filesystems. And just use slice 2 for ZFS: zpool create <poolname> ad0s2
 
[Solved]

Thanks a bunch.
I tried the single user mode first. That didn't read any partition info on the slice. I then tried the Live DVD and that had the same issue. But the:
Code:
# sysctl kern.geom.debugflags=16
worked like a charm.
Thanks again,
Cody
 
Back
Top