12 Replies Latest reply: Aug 15, 2012 10:42 AM by 885866 RSS

    Change rpool dataset name

    847536
      Can I change the dataset name for a root pool? When I built the system I modified the default dataset name to something less confusing. Now it need to change and rebuilding the system is not an option.

      Is this possible w/o damaging the system?

      Thanks
        • 1. Re: Change rpool dataset name
          Nik
          Hi.
          Please show what you have and what you expect after.


          Regards.
          • 2. Re: Change rpool dataset name
            bobthesungeek76036
            Easiest way would be to create a new BE with the desired name and boot off the new BE.

            <pre>man beadm</pre>

            You posted this under the "Solaris Zones" forum. Are you talking about a zone dataset name?
            • 3. Re: Change rpool dataset name
              847536
              Hello, I may be confused.... No the first time.... so be gentile... <grin>

              I have Solaris 10 installed with a ZFS root pool.

              ZFS List shows

              rpool
              rpool/ROOT
              rpool/ROOT/server-foo
              rpool/ROOT/server-foo/var


              I'd like to change server-foo to app-server

              so the ZFS List shows

              rpool
              rpool/ROOT
              rpool/ROOT/app-server
              rpool/ROOT/app-server/var


              Am I indeed in the wrong forum?

              Humble apologies
              "Lost"
              • 4. Re: Change rpool dataset name
                941184
                Hi,
                its root FS so you must boot from other Solaris, for example CD, or easiest failsafe because to rename a ZFS it must be remounted and if is in use (like root or var) is not possible. For sparc:

                # init 0
                # boot -F failsafe

                # zfs rename rpool/ROOT/server-foo rpool/ROOT/app-server
                # zfs rename rpool/ROOT/server-foo/var rpool/ROOT/app-server/var
                # zfs list

                # init 6
                • 5. Re: Change rpool dataset name
                  SteveS
                  You can rename the dataset using:

                  # zfs rename rpool/ROOT/server-foo rpool/ROOT/app-server

                  From the zfs(1M) man page:
                       zfs rename filesystem|volume|snapshot
                       filesystem|volume|snapshot
                       zfs rename [-p] filesystem|volume filesystem|volume
                  
                           Renames the given dataset. The new target can be located
                           anywhere  in  the  ZFS  hierarchy, with the exception of
                           snapshots. Snapshots can  only  be  renamed  within  the
                           parent  file system or volume. When renaming a snapshot,
                           the parent file system of the snapshot does not need  to
                           be  specified  as  part  of the second argument. Renamed
                           file systems can inherit new mount points, in which case
                           they are unmounted and remounted at the new mount point.
                  
                           -p
                  
                               Creates  all  the   nonexistent   parent   datasets.
                               Datasets  created  in  this manner are automatically
                               mounted according to the mountpoint property  inher-
                               ited from their parent.
                  
                       zfs rename -r snapshot snapshot
                  
                           Recursively  rename  the  snapshots  of  all  descendent
                           datasets.  Snapshots  are  the  only dataset that can be
                           renamed recursively.
                  You'll need to ensure the application is down so the umount works. Alternatively you can keep the current dataset name and change the mountpoint using 'zfs set mountpoint=/app-server rpool/ROOT/app-server'
                  Am I indeed in the wrong forum?
                  Yes. There isn't currently a dedicated ZFS forum so it's best to use the Solaris 10 or Solaris 11 forums. If you have a support contract there IS a dedicated ZFS area on http://communities.oracle.com
                  • 6. Re: Change rpool dataset name
                    Nik
                    Hi.
                    Do not do steps from above posts. It's make you systems unbootable.

                    Correct way:
                    Create new boot environment; acivate new boot environment; reboot with new boot environment.
                    Remove old boot environment.

                    Docs:
                    http://docs.oracle.com/cd/E19253-01/821-0438/zfsoverview/index.html


                    So it wiil look like:


                    Create new BE:
                    lucreate -c server-foo -n app-server

                    Activate new BE app-server:
                    luactivate app-server

                    Reboot system:
                    init 6 ( Do not use just reboot on this step).

                    After reboot you can check that correct dataset used for root

                    Remove old BE:

                    ludelete server-foo


                    Regards

                    Edited by: Nik on 01.06.2012 15:32
                    • 7. Re: Change rpool dataset name
                      941184
                      Nik,
                      to make another environment works, but its irrational for only to change the name of de zfs root filesystem.

                      The easiest and normal way its use zfs rename. The only difference in this case its that zfs root filesystem can't be remounted so its necesary first boot from another kernel (failsafe, CDROM...)

                      Its a little bold your first phrase.

                      Regards
                      • 8. Re: Change rpool dataset name
                        Nik
                        After renamnig root dataset you should:

                        1. Check properties for rootfs at pool rpool and change it.
                        2. rename device for swap and correct /etc/vfstab
                        etc....

                        So in case you like troubleshut boot problem - you can rename this dataset.
                        Regards
                        • 9. Re: Change rpool dataset name
                          941184
                          I do not want to become envolved in an endless discuss about this, but the procedure that I have sent it has been done for me several times without problems, changing only FS names for var-root (case of this thread) and also changing the name of rpool.

                          About your points ...
                          The only property that must be changed its mountpoint and have changed with zfs remount, the rest remain intact.
                          + A machine with ZFS puts no entries / /var in vfstab
                          + The swap device remains intact, do not rename it because it has not changed the name rpool.

                          Regards.
                          • 10. Re: Change rpool dataset name
                            bobthesungeek76036
                            rar wrote:
                            Nik,
                            to make another environment works, but its irrational for only to change the name of de zfs root filesystem.

                            The easiest and normal way its use zfs rename. The only difference in this case its that zfs root filesystem can't be remounted so its necesary first boot from another kernel (failsafe, CDROM...)

                            Its a little bold your first phrase.

                            Regards
                            While your method might be technically correct, it might not be the best advice for a novice admin. Folks that usually post here for advice are novice and we usually try to give the most failsafe advice. What if the system doesn't have a DVD/CDROM drive connected? That is why we would suggest creating an alternate boot environment for this task.
                            • 11. Re: Change rpool dataset name
                              941184
                              Hello bobthesungeek76036 ,
                              to make "boot -F failsafe" you dont need jumpstart, CDROM... nothing.

                              I don't think the method wroted by me is for advanced admins... but each one uses the method that is most comfortable for himself


                              Regards.
                              • 12. Re: Change rpool dataset name
                                885866
                                in my opinion the lucreate steps posted by nik are the easiest and safest option. let the OS tools do the work for you!