How to move my iocage to another drive

hAtul

Dabbler
Joined
Nov 28, 2020
Messages
36
Hello,

I have a new TEAM 456G SSD drive (first), which I want to move all my stuff like the IOCAGE and shared files to from my Samsung drive (last).
I started getting all confused while experimenting with this. I got an error
1670593429766.png


Then I think I read that since this is a replication from a snapshot it will generate a "copy" but it's not a "real copy"?


To sum things up.
- I want to know how to move my "iocage" to the new ssd.
- I want to move my shared data folder to the new ssd.

Edit:
I've been following this:

and got stuck with getting my jails running (the edit step results an error) after `iocage fstab -e PlexMediaServer`
Error: Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 650, in json_write
with iocage_lib.ioc_common.open_atomic(write_location, 'w') as out:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_common.py", line 590, in open_atomic
with tempfile(dir=os.path.dirname(os.path.abspath(filepath))) as tmppath:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_common.py", line 553, in tempfile
tf = tmp.NamedTemporaryFile(delete=False, suffix=suffix, dir=dir)
File "/usr/local/lib/python3.9/tempfile.py", line 545, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/usr/local/lib/python3.9/tempfile.py", line 255, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/TEAM476/iocage/tmp963gbmqo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/jail_freebsd.py", line 1074, in get_activated_pool
pool = ioc.IOCage(skip_jails=True, reset_cache=True).get('', pool=True)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/iocage.py", line 95, in __init__
self.generic_iocjson = ioc_json.IOCJson()
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 1372, in __init__
super().__init__(location, checking_datasets, silent, callback)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 432, in __init__
self.default_config = self.check_default_config()
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 1302, in check_default_config
self.json_write(default_props, default_json_location,
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 654, in json_write
raise FileNotFoundError(write_location)
FileNotFoundError: /mnt/TEAM476/iocage/defaults.json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 650, in json_write
with iocage_lib.ioc_common.open_atomic(write_location, 'w') as out:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_common.py", line 590, in open_atomic
with tempfile(dir=os.path.dirname(os.path.abspath(filepath))) as tmppath:
File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_common.py", line 553, in tempfile
tf = tmp.NamedTemporaryFile(delete=False, suffix=suffix, dir=dir)
File "/usr/local/lib/python3.9/tempfile.py", line 545, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/usr/local/lib/python3.9/tempfile.py", line 255, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/TEAM476/iocage/tmple009sqf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 139, in call_method
result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self)
File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1246, in _call
return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1151, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/middlewared/schema.py", line 979, in nf
return f(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/jail_freebsd.py", line 1081, in get_activated_pool
pool = ioc.IOCage(skip_jails=True).get('', pool=True)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/iocage.py", line 95, in __init__
self.generic_iocjson = ioc_json.IOCJson()
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 1372, in __init__
super().__init__(location, checking_datasets, silent, callback)
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 432, in __init__
self.default_config = self.check_default_config()
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 1302, in check_default_config
self.json_write(default_props, default_json_location,
File "/usr/local/lib/python3.9/site-packages/iocage_lib/ioc_json.py", line 654, in json_write
raise FileNotFoundError(write_location)
FileNotFoundError: /mnt/TEAM476/iocage/defaults.json

1670593006562.png
 

Attachments

  • 1670593889898.png
    1670593889898.png
    874.7 KB · Views: 107
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Moving iocage from one pool to another is not really about doing a block-level copy of the pool (which is what replication will do).

Either you are:

Replicating to another pool which you will rename to the same as the original after you're done with the copy and have removed the original

or

Running iocage export on all your jails, picking up the exported jails (from /mnt/<poolname>/iocage/images/) and copying them out to the new pool, changing the pool in the jail settings, then putting back the exported files in the new pool (to /mnt/<newpoolname>/iocage/images/) and running iocage import on all your jails. (and fetching your images again with iocage fetch)
 

hAtul

Dabbler
Joined
Nov 28, 2020
Messages
36
Moving iocage from one pool to another is not really about doing a block-level copy of the pool (which is what replication will do).

Either you are:

Replicating to another pool which you will rename to the same as the original after you're done with the copy and have removed the original

or

Running iocage export on all your jails, picking up the exported jails (from /mnt/<poolname>/iocage/images/) and copying them out to the new pool, changing the pool in the jail settings, then putting back the exported files in the new pool (to /mnt/<newpoolname>/iocage/images/) and running iocage import on all your jails. (and fetching your images again with iocage fetch)
I understand that it's not a plain copy-paste of file, since I have to point of new mnt points.. Im just not sure at which stage I am in reference to your comment o_O
Now I have an iocage in TEAM476.
all of the commands:
iocage stop ALL
zfs unmount -f tank/iocage
zfs snapshot -r tank/iocage@migration
zfs send -R tank/iocage@migration | zfs receive -v dozer/iocage
iocage clean -a
zfs destroy -f tank/iocage
iocage activate dozer
zfs destroy -r dozer/iocage@migration
ran successfully, except of the last one `zfs destroy -r dozer/iocage@migration` which I am afraid to destroy yet.

`iocage fstab -e`
returns the output mentioned in my updated main post.
+
im not sure I understand what exactly is missing and what does "default" holds.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Looks to me like you didn't follow either of the 2 paths I suggested and are instead trying to mix them both.

If you already replicated the iocage structure to a new pool, now you need that new pool to be named like the old one... but if you already ran the iocage activate on the new pool name, now it's a real mess... and you didn't export your jails first either.

I'm not sure if it's recoverable, but you can start by looking at the errors you posted and see if the files that are missing are indeed not there and/or are still there in the old pool.
 

hAtul

Dabbler
Joined
Nov 28, 2020
Messages
36
Looks to me like you didn't follow either of the 2 paths I suggested and are instead trying to mix them both.

If you already replicated the iocage structure to a new pool, now you need that new pool to be named like the old one... but if you already ran the iocage activate on the new pool name, now it's a real mess... and you didn't export your jails first either.

I'm not sure if it's recoverable, but you can start by looking at the errors you posted and see if the files that are missing are indeed not there and/or are still there in the old pool.
unfortunately, I saw your post after I updated it.
deactivating the new and activating the old iocage maybe then run the export thing.

found nothing relevant to the errors..
 
Top