Clone a zvol/vm

Status
Not open for further replies.

Rybena

Dabbler
Joined
Jun 25, 2017
Messages
32
Does anyone know how to do this?

I have a ubuntu vm running on freenas with its storage in a jail as a zvol named "ubuntu-server-nextcloud"
I want to rename it as "ubuntu-server" so removing "nextcloud".

Is this possible?

If not I have created a new zvol named "ubuntu-server" and pointed the vm storage to this zvol.

How can i clone the "ubuntu-server-nextcloud" zvol to "ubuntu-server" zvol? then i can delete ubuntu-server-nextcloud" zvol.

Doing it this way is a long way round of just renaming the zvol but I cant get it to work either way and I dont want to go through the process of reinstallind ubuntu onto a new zvol.

Thanks
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Renaming is easy. Just stop your VM first.

zfs rename tank/path/to/zvol tank/newpath/to/zvol

Then in the VM config, point it to the new ZVOL name.
 

Rybena

Dabbler
Joined
Jun 25, 2017
Messages
32
Renaming is easy. Just stop your VM first.

zfs rename tank/path/to/zvol tank/newpath/to/zvol

Then in the VM config, point it to the new ZVOL name.


Thanks for the reply

When I try this is says
tank/path/to/zvol dataset does not exist

Im certain I have the correct path as I have checked it several times but still get the same reply
 

IceBoosteR

Guru
Joined
Sep 27, 2016
Messages
503
Could you share the full command you have tried to get this to work?
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
When I try this is says
tank/path/to/zvol dataset does not exist
You took my post too literal. What I provided was an example. You need to change the example tank/path/to/zvol,etc. to your pool and zvol path.
 

Rybena

Dabbler
Joined
Jun 25, 2017
Messages
32
Could you share the full command you have tried to get this to work?

Hi

This is the command I used:

[root@freenas ~]# zfs rename tank/dev/zvol/main-pool/jails/ubuntu-server-nextcloud tank/dev/zvol/main-pool/jails/ubuntu-server

and this is the output:
cannot open 'tank/dev/zvol/main-pool/jails/ubuntu-server-nextcloud': dataset does not exist
 

Rybena

Dabbler
Joined
Jun 25, 2017
Messages
32
You took my post too literal. What I provided was an example. You need to change the example tank/path/to/zvol,etc. to your pool and zvol path.


lol I know it was an example...Iv posted the command I used in the reply just before this one.

Thanks
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Your command is still wrong.

You only need to provide the pool name and path to the zvol. In your case this is main-pool/jails/ubuntu-server-nextcloud.

So you rename command will be: zfs rename main-pool/jails/ubuntu-server-nextcloud main-pool/jails/ubuntu-server
 

Rybena

Dabbler
Joined
Jun 25, 2017
Messages
32
Your command is still wrong.

You only need to provide the pool name and path to the zvol. In your case this is main-pool/jails/ubuntu-server-nextcloud.

So you rename command will be: zfs rename main-pool/jails/ubuntu-server-nextcloud main-pool/jails/ubuntu-server

Awesome that worked!

Thanks so much

So for future the reason why my command was wrong was because zfs command already points towards the zvol?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
So for future the reason why my command was wrong was because zfs command already points towards the zvol?
Not exactly. The zfs command operates on zfs paths--pool, dataset, zvol. Those may, but don't need to, mirror filesystem paths.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
So for future the reason why my command was wrong was because zfs command already points towards the zvol?
You mean pool. They're completely different things.

Edit: Specified the context
 
Last edited:
Status
Not open for further replies.
Top