ZFS "zfs create" on directory with existing data

molofishy

Member

Reaction score: 6
Messages: 60

I have a single disk on my server. I simply went for ZFS "stripe" (no redundancy) when installing FreeBSD. zpool status prints the following:
Code:
pool: zroot
state: ONLINE
scan: none requested

config:
NAME        STATE     READ WRITE CKSUM
zroot       ONLINE       0     0     0
ada0p4    ONLINE       0     0     0
errors: No known data errors

And zfs list the following:
Code:
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot               3.78G   219G    96K  /zroot
zroot/ROOT          2.49G   219G    96K  none
zroot/ROOT/default  2.49G   219G  2.49G  /
zroot/tmp            138M   219G   138M  /tmp
zroot/usr           1.15G   219G    96K  /usr
zroot/usr/home       523M   219G   523M  /usr/home
zroot/usr/ports      658M   219G   658M  /usr/ports
zroot/usr/src         96K   219G    96K  /usr/src
zroot/var           1.17M   219G    96K  /var
zroot/var/audit       96K   219G    96K  /var/audit
zroot/var/crash       96K   219G    96K  /var/crash
zroot/var/log        508K   219G   508K  /var/log
zroot/var/mail       308K   219G   308K  /var/mail
zroot/var/tmp         96K   219G    96K  /var/tmp

I have two basic questions:
  1. Since I only have 1 disk, is creating a new zpool needed/possible? Or should I create zfs filesystems in the existing "zroot" zpool?
  2. I already have data in my home directory ( /user/home/username), but this directory is not a ZFS filesystem. I thought I could add it as one with zfs create zroot/usr/home/username, but then data in that directory disappeared. To recover it I had to destroy the filesystem with zfs destroy zroot/usr/home/username. How can I make my home directory a ZFS filesystem while it has data in it? Or should I have created it before putting moving data into it?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,767
Messages: 39,377

Since I only have 1 disk, is creating a new zpool needed/possible? Or should I create zfs filesystems in the existing "zroot" zpool?
With one disk you can only have one pool. A disk can only be assigned to a single pool. You can, however, add another disk and create a new pool with that.

How can I make my home directory a ZFS filesystem while it has data in it? Or should I have created it before putting moving data into it?
You need to create it before putting the data into it. Simple solution, create the filesystem, mount it on a temporary space (/mnt for example), move the data, remount it on the proper place.
 

TheDreamer

Member

Reaction score: 6
Messages: 68

Actually, it is possible to have more than one zpool on a disk (or disks), but it is strongly not recommended. ZFS performance is based on it having the whole disk, and managing all the I/O requests. The two zpools would not know about each other I/O demands, and result in poor performance.

I had this problem because had initially configured the system with half of each drive for another OS (mirrored zpool), but once I got X working with my video card (or rather I found a video card that worked) and got a usable desktop environment for work...I had no need for the other system...especially needing something that would be available 24/7....and of my work machines, the FreeBSD one was the most stable. Until the power supply died. (a few months after the 4 year Dell support contract ran out.)

The Dreamer.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,767
Messages: 39,377

Actually, it is possible to have more than one zpool on a disk (or disks), but it is strongly not recommended
Technically you could split the disk up into two partitions and assign each to its own pool, yes. But you can't assign one of those partitions to two pools. Once a partition (or disk) is assigned to one pool you can't add it to another.
 
Top