4 Replies Latest reply: Jul 8, 2013 5:43 PM by ktim RSS

How do I provide BlockRanges to Start-NaClone

Currently Being Moderated

I'm trying to do a sub-file clone using the toolkit. Start-NaClone has a [-BlockRanges <BlockRange[]>] parameter.


Each block range is an instance of type DataONTAP.Types.Clone.BlockRange, but I can't work out how to populate a BlockRange object, and can't find any examples or documentation around this.


Any ideas?



  • Re: How do I provide BlockRanges to Start-NaClone
    Currently Being Moderated

    Check out the help for this cmdlet.


    Get-Help Start-NaClone -Examples



    PS C:\Windows\system32> Get-Help Start-NaClone -Examples








        Starts a file/LUN or sub-file/sub-LUN clone operation.



        --------------  Example 1 --------------



        C:\PS>Start-NaClone /vol/vol2/lun1 /vol/vol2/lun1clone


        Create a clone 'lun1clone' of LUN 'lun1'.


        SourceFile      : /vol/vol2/lun1

        DestinationFile : /vol/vol2/lun1clone

        CloneState      : running

        TotalBytes      : 21476192256

        PercentDone     : 0

        BytesCopied     : 0

        CloneType       : lun

        CloneId         : 12

        Error           :

        Reason          :


    --------------  Example 2 --------------


    C:\PS>Get-NaLun /vol/vol2/lun1 | Start-NaClone

    Clone LUN 'lun1' and accept the default destination name 'lun1Clone'.

    • Re: How do I provide BlockRanges to Start-NaClone
      Currently Being Moderated

      Hi Vinith,


      Been there... no information on how to construct BlockRanges...




      • Re: How do I provide BlockRanges to Start-NaClone
        Currently Being Moderated

        Hi Tim,


        The BlockRange object is a block range descriptor containing three key fields:  SourceBlockNumber, DestinationBlockNumber, and BlockCount.  For LUNs, these block ranges are 512-byte LBA ranges, and for WAFL files they are 4k blocks.


        You can create a BlockRange object using the New-Object cmdlet, for example:

        $blockRange = New-Object DataONTAP.Types.Clone.BlockRange

        $blockRange.SourceBlockNumber = 0

        $blockRange.DestinationBlockNumber = 1024

        $blockRange.BlockCount = 4096


        Calculating the block ranges is the tricky part.  For WAFL files it is fairly straightforward as long as you remember there are 4096 bytes in a WAFL block.  If you are trying to sub-file clone a file on a LUN, it is significantly more complicated (and risky).  You must find the block ranges the file occupies on the LUN, then calculate which block ranges fall in the part of the file you want to clone.  Copy-NaHostFile handles this for you, but does not do sub-file cloning.  Getting the source and destination block numbers wrong could very easily corrupt the LUN.



More Like This

  • Retrieving data ...