Skip to main content

Restore part of a file from a Snapshot copy

Contributors netapp-aherbin netapp-ahibbard

You can use the volume snapshot partial-restore-file command to restore a range of data from a Snapshot copy to a LUN or to an NFS or SMB container file, assuming you know the starting byte offset of the data and the byte count. You might use this command to restore one of the databases on a host that stores multiple databases in the same LUN.

Beginning in ONTAP 9.12.1, partial restore is available for volumes in an SM-BC relationship.

Steps
  1. List the Snapshot copies in a volume:

    volume snapshot show -vserver SVM -volume volume

    For complete command syntax, see the man page.

    The following example shows the Snapshot copies in vol1:

    clus1::> volume snapshot show -vserver vs1 -volume vol1
    
    Vserver Volume Snapshot                State    Size  Total% Used%
    ------- ------ ---------- ----------- ------   -----  ------ -----
    vs1	 vol1   hourly.2013-01-25_0005  valid   224KB     0%    0%
                   daily.2013-01-25_0010   valid   92KB      0%    0%
                   hourly.2013-01-25_0105  valid   228KB     0%    0%
                   hourly.2013-01-25_0205  valid   236KB     0%    0%
                   hourly.2013-01-25_0305  valid   244KB     0%    0%
                   hourly.2013-01-25_0405  valid   244KB     0%    0%
                   hourly.2013-01-25_0505  valid   244KB     0%    0%
    
    7 entries were displayed.
  2. Restore part of a file from a Snapshot copy:

    volume snapshot partial-restore-file -vserver SVM -volume volume -snapshot snapshot -path file_path -start-byte starting_byte -byte-count byte_count

    The starting byte offset and byte count must be multiples of 4,096.

    The following example restores the first 4,096 bytes of the file myfile.txt:

    cluster1::> volume snapshot partial-restore-file -vserver vs0 -volume vol1 -snapshot daily.2013-01-25_0010 -path /myfile.txt -start-byte 0 -byte-count 4096