Skip to content

Instantly share code, notes, and snippets.

@wolstena
Last active August 29, 2015 14:06
Show Gist options
  • Save wolstena/9b65089a914fc956ea31 to your computer and use it in GitHub Desktop.
Save wolstena/9b65089a914fc956ea31 to your computer and use it in GitHub Desktop.
SmartOS: Rename zonepath

Rename Zonepath

First of all don't arbitrarilly change the zonepath to the zone name when creating zones. Most of the tools assume the uuid is being used. But if you do ignore everyones advice and do it. This is how you can correct it.

  1. Shutdown the zone:

  vmadm stop <zone_uuid>

  1. Backup and clone the file system

  zfs snapshot -r zones@pre_restore
  zfs clone zones/<old_name>@pre_restore zones/<zone_uuid>
  zfs clone -o mountpoint=/zones/<zone_uuid>/cores zones/cores/<old_name>@pre_restore zones/cores/<zone_uuid>

  1. Backup the files in /etc/zones/
  2. Fix the contents in /etc/zones/<old_name></old_name>.xml and copy them to new file <zone_uuid></zone_uuid>.xml
  3. Edit the /etc/zones/index file. Replace the instances of <old_name></old_name> with <zone_uuid></zone_uuid>
  4. Checks

  vmadm get 3dc016bc-eff3-4e0b-9357-0a62b7ac1e57 | json zonename zonepath zfs_filesystem
  prstat -Z
  zlogin &lt;zone_uuid&gt;&lt;/zone_uuid&gt;
  vmadm create-snapshot \&lt;zone_uuid\&gt;&lt;/zone_uuid\&gt; post_zonepath_change

  1. Reboot Server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment