# Several ZFS Questions



## caesius (Feb 20, 2011)

I'm moving /home on to a new HDD. But before I do, I'm thinking: why not have a play with ZFS while I've got a spare drive?

I like what I've seen so far! I have some questions though:

1. Is it really that easy?

Did `# zpool create newhome /dev/ad1` *really* just deal with both creating and automatically mounting this partition!? It seemed too easy, like it will disappear eventually. Where does ZFS store this info? How could I stop this from "mounting" at boot? (I guess that's a thinly veiled way of asking how ZFS and fstab get along)

2. Can I always refer to my new drive by its label?

I.e., is `# zpool create ...` kinda that same as giving it a label with glabel?

3. If I decided to use ZFS for this new /home HDD, could I take out the entire HDD and stick it in another FreeBSD system? What would it be seen as? Would the label be there? How would it know not to automatically try and mount it under /home in the new system?

Gah, so many questions. But I really like ZFS.

Cheers.


----------



## gkontos (Feb 20, 2011)

caesius said:
			
		

> I'm moving /home on to a new HDD. But before I do, I'm thinking: why not have a play with ZFS while I've got a spare drive?
> 
> I like what I've seen so far! I have some questions though:
> 
> ...


It is that easy and nice. But for mounting your new pool under /home you would have to:

```
zfs set mountpoint=/usr/home newhome
```
If you don't want this to be mounting at boot time then you just export it.

```
zpool export -f newhome
```



			
				caesius said:
			
		

> 2. Can I always refer to my new drive by its label?
> 
> I.e., is `# zpool create ...` kinda that same as giving it a label with glabel?


In fact you should. First you label it and the you reference your pool by its label.


			
				caesius said:
			
		

> 3. If I decided to use ZFS for this new /home HDD, could I take out the entire HDD and stick it in another FreeBSD system? What would it be seen as? Would the label be there? How would it know not to automatically  try and mount it under /home in the new system?


[cmd=]zpool import newhome && zfs set mountpoint=/usr/home newhome[/cmd]
Should be enough!


----------



## Sebulon (Feb 20, 2011)

Hey,

just chipping in about not mounting at boot.

`# zfs set mountpoint=legacy pool/home`

Makes zfs go "hands off" with the mounting part, letting the traditional mount do the job, like this:

`# mount -t zfs pool/home /home`

And if youÂ´d like then to have that at mount, add it to fstab:


```
pool/home  /home  zfs  rw  0  0
```

Have fun!

/Sebulon


----------



## caesius (Feb 20, 2011)

RE: Question 3



> [cmd=]zpool import newhome && zfs set mountpoint=/usr/home newhome[/cmd]
> Should be enough!



What if there is a HDD on the new machine with the same label as the one I've just stuck in?


----------



## gkontos (Feb 20, 2011)

caesius said:
			
		

> RE: Question 3
> 
> What if there is a HDD on the new machine with the same label as the one I've just stuck in?


Funny I never thought about that till now. That's something that you definitely need to avoid but frankly the chances are ...


----------



## phoenix (Feb 21, 2011)

Every pool has a GUID assigned behind the scenes.  The name you see if just a handy label.  Similar to how all files has a GUID (called an inode) behind the scenes and a handy label called a filename.  

If you try to import two pools with the same name, you get an error message.  But you can query for the ID and import the pool by ID instead of by name.  There's also an option to import a pool and rename it.

You really should spend some time reading the zpool() and zfs() man pages, and the ZFS System Administration guide (Oracle keeps renaming/moving the links, so you'll need to search for the URL-of-the-week), and some of the linked blogs if you're really interested in using it.  All your basic usage questions like this thread are covered in there.


----------



## caesius (Feb 21, 2011)

phoenix said:
			
		

> Every pool has a GUID assigned behind the scenes.  The name you see if just a handy label.  Similar to how all files has a GUID (called an inode) behind the scenes and a handy label called a filename.
> 
> If you try to import two pools with the same name, you get an error message.  But you can query for the ID and import the pool by ID instead of by name.
> 
> You really should spend some time reading the zpool() and zfs() man pages, and the ZFS System Administration guide, and some of the liked blogs if you're really interested in using it.  All your basic usage questions like this thread are covered in there.


Yes I will admit a smidgen of laziness on my part.

Thanks for replies.


----------

