NetApp FlexClone Tutorial

NetApp FlexClone Tutorial

In this NetApp training tutorial, I will cover the NetApp FlexClone. Scroll down for the video and also text tutorial.

NetApp FlexClone Video Tutorial

YouTube video

Ben Lilley

Ben Lilley

I just passed my NCDA and I owe many thanks to your in-depth, straight forward and enthusiastic content. Being able to see you teach all the features and functionality and then test them out myself was fantastic and helped the info sink in. The ability to come back to the content whenever I need a refresher on something complicated is extremely valuable. Whenever I hear of a new engineer looking to get their NCDA I always point them in your direction first.

Ben Lilley

NetApp FlexClone 

 

A FlexClone volume is, not surprisingly, a clone of another volume. The feature is most commonly used for deploying a virtual desktop environment or for development and testing. Both the parent and child appear on the ‘Volumes’ page in System Manager and can be managed separately.

 

The child FlexClone volume consists of the same data as the parent volume when it is initially created and you can then make independent changes to both.

 

Let’s say you want to do some testing on a large database. The traditional way to do this would be to make a copy of the database. It will take time to copy the data to new blocks on disk, and take up double the initial disk space.

 

FlexClone works differently. The system takes a snapshot of the parent volume. This works the same as any other snapshot in that it just includes pointers to the data, rather than copying it to new blocks on disk. Because no data needs to be written (apart from the tiny inode file), the snapshot occurs instantly and takes up no disk space.

 

The FlexClone child volume is created from the snapshot. After it has been created you can manage the FlexClone as a separate volume. Any new data you write to it will take up disk space, but the existing data from the snapshot does not.

 

Multiple clones can be taken of the same parent volume, so if you need to do additional testing while keeping the first FlexClone volume unchanged, just make another FlexClone volume.

 

NetApp FlexClone

An example of FlexClone in action is shown in the diagram above. ‘VolX’ is the parent volume and we have taken a clone named ‘volX- clone’. When you make a clone it uses a snapshot of the parent volume, so it contains exactly the same data but does not take up any additional space.

 

That data is shown as the ‘shared data blocks’ in the diagram. As either parent or FlexClone volume changes, they will start taking up additional space. You can see that as ‘unique volX data blocks’ and ‘unique volX-clone data blocks’ in the diagram. The shared data blocks remained untouched.

 

Because of the shared blocks both the parent and FlexClone volume are located in the same aggregate.

 

NetApp FlexClone

 

Splitting NetApp FlexClone

 

Over time the FlexClone volume can change enough that it is more different than similar to the parent volume. At this time you can choose to split them into two completely physically separate volumes. Doing this can take some time as the shared data blocks will be split into two separate copies which require them to be copied to new blocks on disk for the child volume.

 

NetApp FlexClone Configuration Example

 

This configuration example is an excerpt from my ‘NetApp ONTAP 9 Complete’ course. Full configuration examples using both the CLI and System Manager GUI are available in the course.

 

Want to practice this configuration for free on your laptop? Download your free step-by-step guide ‘How to Build a NetApp ONTAP Lab for Free’

 

YouTube video

 

  1. Create a new aggregate named ‘aggr3_C1N1’, owned by Node 1. Use RAID-DP and 5 FCAL disks.

 

cluster1::> storage aggregate create -aggregate aggr3_C1N1 -diskcount 5 -disktype FCAL -node cluster1-01

 

Info: The layout for aggregate "aggr3_C1N1" on node "cluster1-01" would be:

 

      First Plex

 

        RAID Group rg0, 5 disks (block checksum, raid_dp)

                                                            Usable Physical

          Position   Disk                      Type           Size     Size

          ---------- ------------------------- ---------- -------- --------

          dparity    NET-1.47                  FCAL              -        -

          parity     NET-1.14                  FCAL              -        -

          data       NET-1.6                   FCAL         1000MB   1.00GB

          data       NET-1.48                  FCAL         1000MB   1.00GB

          data       NET-1.15                  FCAL         1000MB   1.00GB

 

      Aggregate capacity available for volume use would be 2.64GB.

 

Do you want to continue? {y|n}: y

[Job 58] Job succeeded: DONE

 

 

  1. Create a 100 MB thin-provisioned volume named vol2 for the NAS SVM in aggr3_C1N1. Mount it in the SVM namespace under the root volume.

 

cluster1::> volume create -vserver NAS -volume vol2 -aggregate aggr3_C1N1 -size 100MB -space-guarantee none -junction-path /vol2

[Job 62] Job succeeded: Successful

 

  1. Configure vol2 to use the UNIX Security Style and set permissions of 0777.

 

cluster1::> volume modify -vserver NAS -volume vol2 -security-style unix -unix-permissions 0777

Volume modify successful on volume vol2 of Vserver NAS.

 

  1. Log in to the LinuxA host and mount the vol2 volume.

 

flackbox@ubuntu:/$ sudo mkdir /mnt/vol2

[sudo] password for flackbox:

flackbox@ubuntu:/$ sudo mount NAS:/vol2 /mnt/vol2

 

  1. Use the command ‘dd if=/dev/zero of=file1 bs=4K count=10000’ to create a 40 MB file in vol2.

 

flackbox@ubuntu:/$ cd /mnt/vol2

flackbox@ubuntu:/mnt/vol2$ dd if=/dev/zero of=file1 bs=4K count=10000

10000+0 records in

10000+0 records out

40960000 bytes (41 MB, 39 MiB) copied, 1.15929 s, 35.3 MB/s

 

  1. How much space do you expect to be used in the aggr3_C1N1 aggregate? Verify this.

 

Aggr3_C1N1 contains the thin provisioned volume vol2 which contains a 40 MB file, so around 40 MB space is used. (The entire size of the volume, 100 MB, would be used if it was a thick provisioned volume.)

 

cluster1::> storage aggregate show-space -aggregate aggr3_C1N1

 

      Aggregate : aggr3_C1N1

 

      Feature                                          Used      Used%

      --------------------------------           ----------     ------

      Volume Footprints                             40.62MB         2%

      Aggregate Metadata                              248KB         0%

      Snapshot Reserve                                   0B         0%

      Total Used                                    40.86MB         2%

 

      Total Physical Used                           42.34MB         2%

 

  1. Use FlexClone to create a clone of vol2 named vol2_clone1.

 

cluster1::> volume clone create -vserver NAS -flexclone vol2_clone1 -parent-volume vol2

[Job 65] Job succeeded: Successful

 

  1. Mount the vol2_clone1 volume in the NAS SVM namespace.

 

cluster1::> volume mount -vserver NAS -volume vol2_clone1 -junction-path /vol2_clone1

 

  1. Log in to the LinuxA host and mount the vol2_clone1 volume.

 

flackbox@ubuntu:/mnt/vol2$ sudo mkdir /mnt/vol2_clone1

flackbox@ubuntu:/mnt/vol2$ sudo mount NAS:/vol2_clone1 /mnt/vol2_clone1

 

  1. Verify vol2_clone1 is a clone of vol2 and contains file1.

 

flackbox@ubuntu:/mnt/vol2$ cd /mnt/vol2_clone1

flackbox@ubuntu:/mnt/vol2_clone1$ ls -l

total 40164

-rw-rw-r-- 1 flackbox flackbox 40960000 May  3 21:23 file1

 

  1. How much space do you expect to be used in aggregate aggr3_C1N1 now? Verify this.

 

There is still around 40 MB space used in aggr3_C1N1 as vol2_clone1 is a clone based on a snapshot copy and does not take up any space.

 

cluster1::> storage aggregate show-space -aggregate aggr3_C1N1

 

      Aggregate : aggr3_C1N1

 

      Feature                                          Used      Used%

      --------------------------------           ----------     ------

      Volume Footprints                             42.72MB         2%

      Aggregate Metadata                              316KB         0%

      Snapshot Reserve                                   0B         0%

      Total Used                                    43.03MB         2%

 

      Total Physical Used                           44.80MB         2%

 

  1. Use the command ‘dd if=/dev/zero of=file2 bs=4K count=5000’ to create a 20 MB file in vol2_clone1.

 

flackbox@ubuntu:/mnt/vol2_clone1$ dd if=/dev/zero of=file2 bs=4K count=5000

5000+0 records in

5000+0 records out

20480000 bytes (20 MB, 20 MiB) copied, 0.406629 s, 50.4 MB/s

 

  1. Use the command ‘dd if=/dev/zero of=file3 bs=4K count=5000’ to create a 20 MB file in vol2.

 

flackbox@ubuntu:/mnt/vol2_clone1$ cd /mnt/vol2

flackbox@ubuntu:/mnt/vol2$ dd if=/dev/zero of=file3 bs=4K count=5000

5000+0 records in

5000+0 records out

20480000 bytes (20 MB, 20 MiB) copied, 0.355257 s, 57.6 MB/s

 

  1. Verify the contents of vol2 and vol2_clone1 are different. Both volumes should contain the identical file1. Vol2_clone1 should also contain file2 and vol2 should also contain file3.

 

flackbox@ubuntu:/mnt/vol2$ ls -l

total 60248

-rw-rw-r-- 1 flackbox flackbox 40960000 May  3 21:23 file1

-rw-rw-r-- 1 flackbox flackbox 20480000 May  3 21:51 file3

flackbox@ubuntu:/mnt/vol2$ cd /mnt/vol2_clone1

flackbox@ubuntu:/mnt/vol2_clone1$ ls -l

total 60248

-rw-rw-r-- 1 flackbox flackbox 40960000 May  3 21:23 file1

-rw-rw-r-- 1 flackbox flackbox 20480000 May  3 21:50 file2

 

  1. How much space do you expect to be used in aggregate aggr3_C1N1 now? Verify this.

 

aggr3_C1N1 contains a single 40 MB copy of file1 which is in both vol2 and vol2_clone1. It also contains the 20 MB file file2 in vol2_clone1 and the 20 MB file file3 in vol2. The total space used is around 40 MB + 20 MB + 20 MB = 80 MB.

 

If vol2 had been copied instead of cloned the total space used would have been 120 MB.

 

cluster1::> storage aggregate show-space -aggregate aggr3_C1N1

 

Aggregate : aggr3_C1N1

 

      Feature                                          Used      Used%

      --------------------------------           ----------     ------

      Volume Footprints                             81.69MB         3%

      Aggregate Metadata                             1.32MB         0%

      Snapshot Reserve                                   0B         0%

      Total Used                                    83.00MB         3%

 

      Total Physical Used                           85.54MB         3%

 

Additional Resources

 

FlexClone Back to Basics

Understanding NetApp FlexClone

 

Want to practice NetApp storage on your laptop for free? Download my free step-by-step guide 'How to Build a NetApp ONTAP Lab for Free'

 

Click Here to get my 'NetApp ONTAP 9 Storage Complete' training course, the highest rated NetApp course online with a 4.8 star rating from over 1000 public reviews.