ZFS How Do I Use ZFS On My Server?

RedPhoenix

Well-Known Member

Reaction score: 66
Messages: 269

So I'm reading about ZFS on the FreeBSD ZFS quick-start guide, and I'm stuck at this part: when I attempt to use a device (/dev/da0), it throws an error and the device dissapears until I reboot. :\ Specifically, this: zpool create example/ dev/da0, and throws the error: cannot open '/dev/da0': No such file or directory, which is strange, since the guide says to try just that. :( I suspect the guide actually requires a physical Device to be plugged into a USB Port. However, until I can get a proper RAID set up, performing backups on-Disk is the only option I have... Any ideas guys? :) I don't want to skip around on the guide, since I might miss something important. :) Thanks for any help. :)
 
OP
RedPhoenix

RedPhoenix

Well-Known Member

Reaction score: 66
Messages: 269

scottro

Daemon

Reaction score: 925
Messages: 2,071

If they're running things already, then yes, probably. :) So, I think what you want to do is add a drive, either another SATA if you have it around, or, if you're just testing for learning, even a USB stick (which will probably show up as da<something>.

If you don't have an empty /dev/ada1, for example, then you are correct, you would overwrite something.
 
OP
RedPhoenix

RedPhoenix

Well-Known Member

Reaction score: 66
Messages: 269

If they're running things already, then yes, probably. :) So, I think what you want to do is add a drive, either another SATA if you have it around, or, if you're just testing for learning, even a USB stick (which will probably show up as da<something>.

If you don't have an empty /dev/ada1, for example, then you are correct, you would overwrite something.
Well, it appears I'm not as dumb as I thought... :D Ok, I'll permantly attach a USB for that purpose as I have the Hard Drive, but no way to attach it. :) Now, the question is: how much do I need? I currently have an 8GB one, but am working on LZMA Files, so I guess that shouldn't be an issue...
 
OP
RedPhoenix

RedPhoenix

Well-Known Member

Reaction score: 66
Messages: 269

If they're running things already, then yes, probably. :) So, I think what you want to do is add a drive, either another SATA if you have it around, or, if you're just testing for learning, even a USB stick (which will probably show up as da<something>.

If you don't have an empty /dev/ada1, for example, then you are correct, you would overwrite something.
Hey, I'm back. :) I got the USB ready, but when I try and run the same Commands, it returns cannot create 'communitypool': no such pool or dataset. This is odd, since I only changed the name of the example. :\ Do I need to Partition the USB as ZFS? :) It's currently formatted as FAT32. :)
 

k.jacker

Aspiring Daemon

Reaction score: 475
Messages: 740

You could either use raw disks (e.g. /dev/da0) or a partition of type freebsd-zfs (e.g. /dev/da0p1). I prefer partitions.
Device names depend on factors like drive type and partitioning scheme. Basic understanding of such things can be very helpful if you really want to use ZFS ;)

If you don't have disks, for testing purposes, files work, too. Minimum size is 64MiB.
So if you want to play around with more than a single disk, you could use truncate(1) to create files with preallocated space.

To create for example a pool of two striped mirrors, using files as storage providers, the following would do it.
Code:
# mkdir /zfsprovider
# cd /zfsprovider
# truncate -s 512M drive0 drive1 drive2 drive3
# zpool create foo mirror /zfsprovider/drive0 /zfsprovider/drive1 mirror /zfsprovider/drive2 /zfsprovider/drive3
Code:
% zpool status foo
  pool: foo
 state: ONLINE
  scan: scrub repaired 0 in 0 days 00:00:01 with 0 errors on Sat Jun 15 23:15:09 2019
config:

        NAME                     STATE     READ WRITE CKSUM
        foo                      ONLINE       0     0     0
          mirror-0               ONLINE       0     0     0
            /zfsprovider/drive0  ONLINE       0     0     0
            /zfsprovider/drive1  ONLINE       0     0     0
          mirror-1               ONLINE       0     0     0
            /zfsprovider/drive2  ONLINE       0     0     0
            /zfsprovider/drive3  ONLINE       0     0     0

errors: No known data errors
 
OP
RedPhoenix

RedPhoenix

Well-Known Member

Reaction score: 66
Messages: 269

You could either use raw disks (e.g. /dev/da0) or a partition of type freebsd-zfs (e.g. /dev/da0p1). I prefer partitions.
Device names depend on factors like drive type and partitioning scheme. Basic understanding of such things can be very helpful if you really want to use ZFS ;)

If you don't have disks, for testing purposes, files work, too. Minimum size is 64MiB.
So if you want to play around with more than a single disk, you could use truncate(1) to create files with preallocated space.

To create for example a pool of two striped mirrors, using files as storage providers, the following would do it.
Code:
# mkdir /zfsprovider
# cd /zfsprovider
# truncate -s 512M drive0 drive1 drive2 drive3
# zpool create foo mirror /zfsprovider/drive0 /zfsprovider/drive1 mirror /zfsprovider/drive2 /zfsprovider/drive3
Code:
% zpool status foo
  pool: foo
state: ONLINE
  scan: scrub repaired 0 in 0 days 00:00:01 with 0 errors on Sat Jun 15 23:15:09 2019
config:

        NAME                     STATE     READ WRITE CKSUM
        foo                      ONLINE       0     0     0
          mirror-0               ONLINE       0     0     0
            /zfsprovider/drive0  ONLINE       0     0     0
            /zfsprovider/drive1  ONLINE       0     0     0
          mirror-1               ONLINE       0     0     0
            /zfsprovider/drive2  ONLINE       0     0     0
            /zfsprovider/drive3  ONLINE       0     0     0

errors: No known data errors
Well, that's something I didn't know! :) Thanks! :) I've got a USB plugged into the Server, so I'll look into that more... :) Well, off to bed. I'll report back with the results. :)
 
Top