Categories

Our Sponsors

Procedure to swap ZFS pools Solaris

Procedure to add a new ZFS pool to a system, copy the data from an old pool, switch the mounts and remove the old pool.

Sorry there isn’t much in the way of comments or coloring.  It was just copied from the terminal window.  The procedure below does create the ZFS filesystem, clone it, move it, then deletes the old ZFS information.

The procedure uses disks mapped from and EMC array.  The reason it was needed is that a new EMC was introduced so the data needed to be copied from the old EMC to the new EMC disks, and the old EMC disks needed to be disconnected.

The procedure will walk through creating a volume, adding data to it, cloning it, swapping volumes, and deleting the original.

nj11mhf0016$ sudo zpool create -f -m /testa testz1 emcpower1a
nj11mhf0016$ sudo zpool create -f -m /testb testz2 emcpower2a

nj11mhf0016$ zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
testz1                  101G     94K    101G     0%  ONLINE     -
testz2                  101G     94K    101G     0%  ONLINE     -

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000499 101044951     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 61207120    1024 61206096     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 61206096       0 61206096     0%    /tmp
swap                 61206152      56 61206096     1%    /var/run
testz1               104251392      24 104251301     1%    /testa
testz2               104251392      24 104251301     1%    /testb

nj11mhf0016$ sudo zfs create -o quota=24G testz1/data
nj11mhf0016$ sudo zfs create -o quota=24G testz2/data

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000499 101044951     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 61207072    1024 61206048     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 61206048       0 61206048     0%    /tmp
swap                 61206104      56 61206048     1%    /var/run
testz1               104251392      25 104251271     1%    /testa
testz2               104251392      24 104251272     1%    /testb
testz1/data          25165824      24 25165799     1%    /testa/data
testz2/data          25165824      24 25165799     1%    /testb/data

# Copy in some data for testing
sudo rsync -qa -H /var /testa/data/

# Make a few test changes and copy the data to the 2nd mount point.
sudo rsync -qa -H /testa/data/* /testb/data/

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000548 101044902     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 52008488    1024 52007464     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 52007464       0 52007464     0%    /tmp
swap                 52007520      56 52007464     1%    /var/run
testz1               104251392      25 99863975     1%    /testa
testz2               104251392      26 99863897     1%    /testb
testz1/data          25165824 4387236 20778587    18%    /testa/data
testz2/data          25165824 4387339 20778485    18%    /testb/data

Now swap and delete them.

Move testa to the side, just in case.
nj11mhf0016$ zfs list
NAME          USED  AVAIL  REFER  MOUNTPOINT
testz1       4.18G  95.2G  25.5K  /testa
testz1/data  4.18G  19.8G  4.18G  /testa/data
testz2       4.18G  95.2G  26.5K  /testb
testz2/data  4.18G  19.8G  4.18G  /testb/data
nj11mhf0016$ sudo mkdir /move
nj11mhf0016$ sudo zfs set mountpoint=/move testz1

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000550 101044900     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 52004096    1024 52003072     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 52003072       0 52003072     0%    /tmp
swap                 52003128      56 52003072     1%    /var/run
testz2               104251392      26 99863897     1%    /testb
testz2/data          25165824 4387339 20778485    18%    /testb/data
testz1               104251392      25 99863571     1%    /move
testz1/data          25165824 4387627 20778197    18%    /move/data

Move new files onto the old mount.
nj11mhf0016$ sudo zfs set mountpoint=/testa testz2

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000558 101044892     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 51995568    1024 51994544     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 51994544       0 51994544     0%    /tmp
swap                 51994600      56 51994544     1%    /var/run
testz1               104251392      25 99863571     1%    /move
testz1/data          25165824 4387627 20778197    18%    /move/data
testz2               104251392      26 99863838     1%    /testa
testz2/data          25165824 4387339 20778485    18%    /testa/data

# Verify that everything is ok and the same.

# Remove the move pool.
nj11mhf0016$ sudo zfs destroy -r testz1
nj11mhf0016$ sudo zpool destroy testz1

nj11mhf0016$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0    108126717 6000557 101044893     6%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 51977088    1024 51976064     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
fd                         0       0       0     0%    /dev/fd
swap                 51976064       0 51976064     0%    /tmp
swap                 51976120      56 51976064     1%    /var/run
testz2               104251392      26 99863838     1%    /testa
testz2/data          25165824 4387339 20778485    18%    /testa/data

Share

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes