3

I'm trying to create a ZFS pool using the following command:

zpool create MyPool disk /dev/sda

However, I get the following error:

cannot use '/dev/disk': must be a block device or regular file

I feel like I should have been able to find someone with this issue, but I haven't been able to. /dev/sda is a blank drive. Where am I going wrong? Do I have to format the drive before creating a zpool? If so, what format do I use?

E-rich
  • 137
  • 1
  • 1
  • 8
  • Sounds like you need to use a partition of a disk like /dev/sda1 (after fdisk-ing it). – mdpc Aug 26 '14 at 23:51
  • 1
    What partition type do I use? – E-rich Aug 27 '14 at 00:00
  • @mdpc Using partitions are supported, but certainly not a requirement. (The recommended method is to use whole disk.) – fukawi2 Aug 27 '14 at 00:04
  • 2
    No partition is needed. The command you're using is incorrect. – ewwhite Aug 27 '14 at 00:11
  • @fukawi2 any idea where can i find the information about "using whole disk is recommended" any performance issues if partitions are used ? – sherpaurgen Jul 12 '18 at 11:27
  • @satch_boogie http://open-zfs.org/w/index.php?title=Performance_tuning&mobileaction=toggle_view_mobile#Whole_Disks_versus_Partitions – fukawi2 Jul 13 '18 at 01:21
  • @satch_boogie Heres an updated link. I see where says using whole disks is recommended but it doesn't say why. I'd like to know why bc coming from FreeBSD zfs, I've never heard of that recommendation. https://openzfs.github.io/openzfs-docs/man/8/zpoolconcepts.8.html?highlight=partition#Virtual_Devices_(vdevs) – RcoderNY May 18 '21 at 04:07

3 Answers3

8

Remove "disk" from your command line. It's the cause of the error you're receiving.

zpool create MyPool sda
ewwhite
  • 197,159
  • 92
  • 443
  • 809
2

Try using this guide: Aaron Topence - ZFS on Linux.

Assuming you are trying to create a zfs pool called MyPool, using /dev/sda as a disk, try:
# zpool create MyPool sda

ewwhite
  • 197,159
  • 92
  • 443
  • 809
Cbaker510
  • 196
  • 1
0

As the marked answer indicates, the syntax is zpool create <mount> <pool> [raidz(2|3)|mirror] <ids>.

As a follow-on, it is generally recommended to use disk IDs (using ls -lh /dev/disk/by-id/) to ensure continued correct identification of disks between restarts. This also helps physically identify disks when replacing them.

LSgeo
  • 101