1

Coming from Gentoo, I'm still used to partitions, and Logical Volume Management. Having just installed and updated FreeBSD-11-RELEASE, using an entire 500GB disk, like so:

% sudo zpool list
Password:
NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot   460G  10.7G   449G         -     1%     2%  1.00x  ONLINE  -

I'm trying to get my head around the jails concept. While I understand that a jail is akin to the chroot command, I'm missing the meaning in the following command:

zfs create -o mountpoint=/usr/local/jails zroot/jails
zfs create zroot/jails/fulljail1

while reading through FreeBSD Jails the hard way. Can I create a zfs "partition" in an already active pool for an entire disk, or do I need to create the pool sizes manually in the BSD Installer partitioning screen??

2 Answers 2

5

These commands aren't specific to BSD Jails and there are no nested pools here, just a single pool.

Under ZFS, you can create as many datasets as you like in a pool. These datasets can be either volumes or file systems. Here two extra file systems are created. They are laid out a hierarchical manner so here are the three file systems present in the pool:

zroot  
zroot/jails  
zroot/jails/fulljail1

and their mount points are:

/  
/usr/local/jails  
/usr/local/jails/fulljail1  

Under ZFS, creating a file system is a much lighter operation than with traditional file systems as there is no need to have a dedicated volume for it. All file systems share the same disk space. Creating a file system is nearly as lightweight as creating a new directory but has many advantages comparing to mkdir. For example you can create snapshots, clone, send, receive, set properties like compression or case sensitivity, mount elsewhere a zfs file system.

4
  • Is this why parts of a zpool are referred to as a slice? I wasn't understanding the concept that I can divide a pool into smaller pieces while using the active pool.
    – eyoung100
    Apr 16, 2017 at 22:27
  • @eyoung100 No, a slice is just a traditional partition (on Solaris and BSD). You can create a zpool on a slice (partition) instead of a whole disk.
    – user121391
    Apr 18, 2017 at 7:08
  • 1
    @user121391 Actually slice and partition terms meaning are reversed under Solaris and BSD. The former call MBR partitions (eg. primary, extended) partitions, and the eight potential subdivisions of the Solaris partitions are called slices (or partitions too). Under BSD, the MBR partitions are called slices, while the subpartitions in the BSD slice are called partitions. See freebsd.org/doc/handbook/… . In any case, you can create ZFS pools on whole disks, partitions, slices, files, volumes or any combination of these.
    – jlliagre
    Apr 18, 2017 at 7:20
  • @eyoung100 The pool is not divided into smaller pieces, its whole space is shared between datasets.I mean there is no predefined area dedicated to whatever file system exists. Blocks are allotted on demand and returned to the pool when freed. Think about it just like RAM is used by the OS. No portion of the RAM is dedicated to most programs, they just use what they need wherever it is located in the whole RAM.
    – jlliagre
    Apr 18, 2017 at 7:25
0

Suggest you change your question as it's not clear what you are asking. Appears you're trying to set up jails, not something specific to the zfs filesystem. But for your zfs questions (as well as refer to jlliagre's description):

This command: zfs create -o mountpoint=/usr/local/jails zroot/jails Creates a dataset on the zpool zroot with a mount point of /usr/local/jails

The second command: zfs create zroot/jails/fulljail1 Creates a dataset within zroot/jails which will mount as /usr/local/jails/fulljail1

Also suggest your run zfs list to see what datasets are on your system, along with and reading up on ZFS and some of the other features it offers. Both of which may help you understand the filesystem used by your system, and what it has to offer.

1
  • This question was not on jails, that is correct. As for zfs list see my original question which contains the only pool I have available. Sorry for the delay, as editing the question would have been a bear on my iPad, and a synth upgrade-system caused a 2 day fix.
    – eyoung100
    Apr 16, 2017 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.