<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to create &amp; recover a snapshot in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176142#M138397</link>
    <description>&lt;P&gt;&lt;EM&gt;@&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;No worries I was worried you got stuck and didn't revert the HCC is full of solutions so, don't hesitate to update the thread if you encounter any problems but if the solution provided resolves your issue then that's great  what you need to do is accept and close the thread&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Cheers&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Mar 2018 02:22:28 GMT</pubDate>
    <dc:creator>Shelton</dc:creator>
    <dc:date>2018-03-12T02:22:28Z</dc:date>
    <item>
      <title>How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176137#M138392</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;I have been using AWS machine for practice.My Question is :&lt;BR /&gt;How i Create &amp;amp; Recover Snapshot ? &lt;BR /&gt;Please explain.&lt;BR /&gt;Thanks,&lt;BR /&gt;Mudassar Hussain&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 14:11:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176137#M138392</guid>
      <dc:creator>Learner_1122</dc:creator>
      <dc:date>2018-03-08T14:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176138#M138393</link>
      <description>&lt;P&gt;In this examples I am using a Cloudera virtual box but it the same command on HDP. 
I didn't create a local user mudassar but used hdfs and the hdfs directory&lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Whoami &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;# id
uid=0(root) gid=0(root) groups=0(root) &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Switched to hdfs user &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;# su - hdfs &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Changed directory to tmp to create test files &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;$ cd /tmp &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Created first file &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;$ echo "This is the first text file for mudassar to test snapshot" &amp;gt; text1.txt &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Created second file &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;$ echo "Apache Kafka comes with a pluggable authorizer known as Kafka Authorization Command Line (ACL) Interface, which is used for defining users and allowing or denying them to access its various APIs. The default behavior is that only a superuser is allowed to access all the resources of the Kafka cluster, and no other user can access those resources if no proper ACL is defined for those users. The general format in which Kafka ACL is defined is as follows" &amp;gt; text2.txt&lt;/P&gt;&lt;P&gt;#################&lt;/P&gt;&lt;P&gt;# Here is output&lt;/P&gt;&lt;P&gt;################&lt;/P&gt;&lt;PRE&gt; $ ls -lrt 
-rw-rw-r-- 1 hdfs         hdfs             58 Mar  8 00:34 text1.txt 
-rw-rw-r-- 1 cloudera     hdfs            456 Mar  8 00:37 text2.txt &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Above I changed the owner of text2.txt to cloudera as root user in the local filesystem &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;#chown cloudera:hdfs /tmp/text2.txt &lt;/PRE&gt;&lt;P&gt;################################&lt;/P&gt;&lt;P&gt; # First create a target directory in hdfs &lt;/P&gt;&lt;P&gt;################################ &lt;/P&gt;&lt;PRE&gt;hdfs dfs -mkdir /user/mudassar &lt;/PRE&gt;&lt;P&gt;################################ &lt;/P&gt;&lt;P&gt;# create a snapshottable directory &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfsadmin -allowSnapshot  /user/mudassar &lt;/PRE&gt;&lt;P&gt;output:&lt;BR /&gt;Allowing snaphot on /user/mudassar succeeded &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Check the snapshottable dir in HDFS &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs lsSnapshottableDir &lt;/PRE&gt;&lt;P&gt;Output &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drwxr-xr-x 0 hdfs supergroup 0 2018-03-08 00:54 0 65536 /user/mudassar &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# copy a file from local to the HDFS snapshotable directory &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -put /tmp/text1.txt  /user/mudassar &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Validate the files was copied &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Found 1 items
-rw-r--r--   1 hdfs supergroup         58 2018-03-08 00:55 /user/mudassar/text1.txt
&lt;/STRONG&gt;################################# &lt;/P&gt;&lt;P&gt;# create snapshot &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -createSnapshot /user/mudassar &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output
Created snapshot /user/mudassar/.snapshot/s20180308-005619.181 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Check to see the snapshot &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar/.snapshot &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;
Found 1 items
drwxr-xr-x   - hdfs supergroup          0 2018-03-08 00:56 /user/mudassar/.snapshot/s20180308-005619.181
################################# &lt;/P&gt;&lt;P&gt;# copy another file to the directory&lt;/P&gt;&lt;P&gt; ################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -put /tmp/text2.txt  /user/mudassar &lt;/PRE&gt;&lt;P&gt; ################################# &lt;/P&gt;&lt;P&gt;# Check the files exit in /user/mudassar notice the timestamp,permissions etc &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;output &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Found 2 items&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;-rw-r--r--   1 hdfs supergroup         58 2018-03-08 00:55 /user/mudassar/text1.txt &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-rw-r--r--   1 hdfs supergroup        456 2018-03-08 00:58 /user/mudassar/text2.tx&lt;/STRONG&gt;t &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Changed ownership of one of the files&lt;/P&gt;&lt;P&gt; ################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -chown cloudera:supergroup /user/mudassar/text2.txt &lt;/PRE&gt;&lt;P&gt;#################################&lt;/P&gt;&lt;P&gt; #Create second snapshot &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -createSnapshot /user/mudassar &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# checked the directory notice now we have 2 snapshots one contains ONLY texte1.txt and the other contains both files
################################# &lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar/.snapshot &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Found 2 items &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drwxr-xr-x   - hdfs supergroup          0 2018-03-08 00:56 /user/mudassar/.snapshot/s20180308-005619.181 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drwxr-xr-x   - hdfs supergroup          0 2018-03-08 01:01 /user/mudassar/.snapshot/s20180308-010152.924
&lt;/STRONG&gt;################################# &lt;/P&gt;&lt;P&gt;# Simulate accidental deletion of the files &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -rm  /user/mudassar/* &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;18/03/08 01:06:26 INFO fs.TrashPolicyDefault: Moved: 'hdfs://quickstart.cloudera:8020/user/mudassar/text1.txt' to trash at: hdfs://quickstart.cloudera:8020/user/hdfs/.Trash/Current/user/mudassar/text1.txt &lt;/P&gt;&lt;P&gt;18/03/08 01:06:26 INFO fs.TrashPolicyDefault: Moved: 'hdfs://quickstart.cloudera:8020/user/mudassar/text2.txt' to trash at: hdfs://quickstart.cloudera:8020/user/hdfs/.Trash/Current/user/mudassar/text2.txt &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Validate the files were deleted &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar
Will return nothing  but the directory exist, run  hdfs dfs -ls /user/ &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# check the contents of the latest snapshot xxxxx.924 see above &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls -R /user/mudassar/.snapshot/s20180308-010152.924 &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;-rw-r--r--   1 hdfs     supergroup         58 2018-03-08 00:55 /user/mudassar/.snapshot/s20180308-010152.924/text1.txt &lt;/P&gt;&lt;P&gt;-rw-r--r--   1 cloudera supergroup        456 2018-03-08 00:58 /user/mudassar/.snapshot/s20180308-010152.924/text2.txt &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Recover the 2 files from snapshot using -ptopax option &lt;/P&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -cp -ptopax /user/mudassar/.snapshot/s20180308-010152.924/* /user/mudassar/ &lt;/PRE&gt;&lt;P&gt;################################# &lt;/P&gt;&lt;P&gt;# Validate the files were restored with original timestamps, ownership, permission, ACLs and XAttrs.
################################# &lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;output &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;-rw-r--r--   1 hdfs     supergroup         58 2018-03-08 00:55 /user/mudassar/text1.txt -rw-r--r--   1 cloudera supergroup        456 2018-03-08 00:58 /user/mudassar/text2.txt&lt;/P&gt;&lt;P&gt;There you are recovered the 2 files delete accidentally ,please let me know if that worked out for you&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 17:40:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176138#M138393</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-08T17:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176139#M138394</link>
      <description>@&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;P&gt;Any updates ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:19:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176139#M138394</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-09T06:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176140#M138395</link>
      <description>&lt;P&gt;&lt;EM&gt;@&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;You haven't given your feedback on the method and solution I provided, you should understand that members go a long way to help out and feedback as to whether the solution resolved your  problem is appreciated and in that case you accept the answer to reward the  user and close the thread,so that others with a similar problem could use it as a SOLUTION.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 01:33:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176140#M138395</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-10T01:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176141#M138396</link>
      <description>&lt;P&gt;Hi @geoffrey shelton Okot I am really sorry. actually i was stuck in another task (deadline). I know if someone comes and help you it it great thing. and you always help us a lot. last time my "Acls" topic covers after you help. &lt;BR /&gt;I have not tried this solution yet. but in next coming days i will definitely try this solution and will let you know,&lt;BR /&gt;Many Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 11 Mar 2018 17:31:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176141#M138396</guid>
      <dc:creator>Learner_1122</dc:creator>
      <dc:date>2018-03-11T17:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176142#M138397</link>
      <description>&lt;P&gt;&lt;EM&gt;@&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;No worries I was worried you got stuck and didn't revert the HCC is full of solutions so, don't hesitate to update the thread if you encounter any problems but if the solution provided resolves your issue then that's great  what you need to do is accept and close the thread&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Cheers&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 02:22:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176142#M138397</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-12T02:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176143#M138398</link>
      <description>&lt;P&gt;Thanks A lot &lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271" target="_blank"&gt;@Geoffrey Shelton Okot&lt;/A&gt; &lt;BR /&gt;I have tried this solution and got the output but I am not satisfied from myself on this topic. So i want to do another example,&lt;BR /&gt;Please help me out. I am using Amazon Machine (Hortonworks) :&lt;BR /&gt;First of all I create user : &lt;STRONG&gt;"mudassar"&lt;/STRONG&gt; &lt;BR /&gt;then change the ownership by wrote this command : &lt;BR /&gt;1. &lt;STRONG&gt;"sudo -u hdfs hadoop fs -chown mudassar:mudassar /user/mudassar" &lt;/STRONG&gt;  &lt;BR /&gt;then go to user "mudassar" &lt;BR /&gt;2. &lt;STRONG&gt;sudo su - mudassar&lt;/STRONG&gt; &lt;BR /&gt;then i create a directory(snapdemo) in this user : &lt;BR /&gt;3.  &lt;STRONG&gt;hadoop fs -mkdir /user/mudassar/snapdemo&lt;/STRONG&gt;&lt;BR /&gt;then i create another directory(directory2) in this user :&lt;BR /&gt;4. &lt;STRONG&gt;hadoop fs -mkdir /user/mudassar/directory2&lt;/STRONG&gt; &lt;BR /&gt;Now i have 2 directories in this user. Please see the below screen : &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64618-snapshot.jpg" style="width: 793px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19720i40C02674A363B610/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64618-snapshot.jpg" alt="64618-snapshot.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;1. Now i want to create the text file &lt;STRONG&gt;(text1.txt)&lt;/STRONG&gt;  into &lt;STRONG&gt;"snapdemo"&lt;/STRONG&gt; directory. and then take a snapshot of this directory into another directory &lt;STRONG&gt;(derectory2) &lt;/STRONG&gt;of this user. &lt;BR /&gt;2. then delete the file &lt;B&gt;(text1.txt) &lt;/B&gt;from directory&lt;B&gt; &lt;/B&gt;&lt;B&gt;"snapdemo" &lt;/B&gt; and then recover the snapshot from &lt;STRONG&gt;"directory2". &lt;/STRONG&gt;&lt;BR /&gt;Hope above make sense to you.&lt;BR /&gt;Thanks Again &lt;BR /&gt;Cheers &lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 10:00:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176143#M138398</guid>
      <dc:creator>Learner_1122</dc:creator>
      <dc:date>2019-08-18T10:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176144#M138399</link>
      <description>&lt;P&gt;&lt;EM&gt;@&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The steps 1,2 and 3 are okay.You dont need to create directory2, when you enable a directory as snapshottable in this case &lt;B&gt;/user/mudassar/snapdemo&lt;/B&gt; the snapshots will be created under this directory with .snapshot....... which makes it invisible when you run the hdfs dfs -ls  command&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let me demo on HDP 2.6 &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I will create your user on my local environment. &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;As mudassar as the root user &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;# adduser mudassar &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Switch to superuser and owner of HDFS &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;# su - hdfs &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Create the snapshot demo notice the -p option as the root directory /user/mudassar doesn't exist yet Note: hdfs hadoop will be deprecated so use hdfs dfs command! &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -mkdir -p /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Validate directory &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar 
Found 1 items 
drwxr-xr-x - hdfs hdfs 0 2018-03-15 09:39 /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Change ownership to mudassar &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -chown mudassar /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Validate change of ownership &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar 
Found 1 items 
drwxr-xr-x - mudassar hdfs 0 2018-03-15 09:39 /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Make the directory snapshottable &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfsadmin -allowSnapshot /user/mudassar/snapdemo 
Allowing snaphot on /user/mudassar/snapdemo succeeded&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Show all the snapshottable directories in your cluster a subcommand under &lt;STRONG&gt;hdfs&lt;/STRONG&gt; &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs lsSnapshottableDir 
drwxr-xr-x 0 mudassar hdfs 0 2018-03-15 09:39 0 65536 /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Create 2 sample files in /tmp &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ echo "Test one for snaphot No worries No worries I was worried you got stuck and didn't revert the HCC is full of solutions so" &amp;gt; /tmp/text1.txt 
$ echo "The default behavior is that only a superuser is allowed to access all the resources of the Kafka cluster, and no other user can access those resources" &amp;gt; /tmp/text2.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Validate the files were created &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$cd /tmp 
$ls -lrt 
-rw-r--r-- 1 hdfs hadoop 121 Mar 15 10:04 text1.txt 
-rw-r--r-- 1 hdfs hadoop 152 Mar 15 10:04 text2.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Copy the files from locall to HDFS &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -put text1.txt /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Create a snapshot of the file text1.txt &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -createSnapshot /user/mudassar/snapdemo 
Created snapshot /user/mudassar/snapdemo/.snapshot/s20180315-101148.262 &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Note above the .snapshot directory which is a hidden system directory  &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Show the snapshot of &lt;B&gt;text1.txt &lt;/B&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar/snapdemo/.snapshot/s20180315-101148.262 
Found 1 items 
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/.snapshot/s20180315-101148.262/text1.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Copied the second file text2.txt from local &lt;STRONG&gt;/tmp &lt;/STRONG&gt;to &lt;STRONG&gt;HDFS&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -put text2.txt /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Validation that the 2 files should be resent &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar/snapdemo 
Found 2 items 
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/text1.txt 
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Demo simulate loss of file text1.txt &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -rm /user/mudassar/snapdemo/text1.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Indeed file text1.txt was deleted ONLY text2.txt remains &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -ls /user/mudassar/snapdemo 
Found 1 items 
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Restore the text1.txt &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs dfs -cp -ptopax /user/mudassar/snapdemo/.snapshot/s20180315-101148.262/text1.txt /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;To use -ptopax this ensure the timestamp is restored you will need to set the &lt;STRONG&gt;dfs.namenode.accesstime.precision&lt;/STRONG&gt; to default 1 hr which is &lt;STRONG&gt;360000 &lt;/STRONG&gt;seconds &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Check the original timestamp for text1.txt above !!! &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /user/mudassar/snapdemo 
Found 2 items 
-rw-r--r-- 3 hdfs hdfs 121 2018-03-15 10:10 /user/mudassar/snapdemo/text1.txt 
-rw-r--r-- 3 hdfs hdfs 152 2018-03-15 10:19 /user/mudassar/snapdemo/text2.txt &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;In a nutshell, you don't need to create &lt;STRONG&gt;directory2&lt;/STRONG&gt; because when you run &lt;STRONG&gt;hdfs dfs&lt;/STRONG&gt;&lt;STRONG&gt; -createSnapshot&lt;/STRONG&gt; command it autocreates a directory under the original starting with &lt;STRONG&gt;.snapshot&lt;/STRONG&gt;, that also saves you from extra steps of creating sort of a backup directory.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; I hope that explains it clearly this time&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 17:05:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176144#M138399</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-15T17:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176145#M138400</link>
      <description>&lt;P&gt;Thanks a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  @&lt;A href="https://community.hortonworks.com/users/1271/sheltong.html"&gt;Geoffrey Shelton Okot&lt;BR /&gt;&lt;/A&gt;I got the desired output. I will do some more work on this topic. &lt;BR /&gt;I will let you know if i will stuck at any point.&lt;BR /&gt;one thing i wana let you know, below command not working at my machine : &lt;BR /&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;STRONG&gt;hdfs lsSnapshottableDir "&lt;/STRONG&gt; &lt;EM&gt;Show all the snapshot-table directories &lt;BR /&gt;&lt;/EM&gt;Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 18:51:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176145#M138400</guid>
      <dc:creator>Learner_1122</dc:creator>
      <dc:date>2018-03-15T18:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176146#M138401</link>
      <description>&lt;P&gt;&lt;EM&gt; @&lt;A href="https://community.hortonworks.com/users/44156/mudassarlhr.html"&gt;Mudassar Hussain&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I am positive that command should and will work without fail if you have successfully created a snapshottable directory. Its a sub command of hdfs  can you simply run hdfs a the hdfs user?&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;$ hdfs Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND 
where COMMAND is one of: 
dfs 			run a filesystem command on the file systems supported in Hadoop. 
classpath 		prints the classpath 
namenode -format 	format the DFS filesystem 
secondarynamenode 	run the DFS secondary namenode 
namenode 		run the DFS namenode 
journalnode 		run the DFS journalnode 
.......
........
snapshotDiff 		diff two snapshots of a directory or diff the current directory contents  a snapshot 
lsSnapshottableDir 	list all snapshottable dirs owned by the current user 
Use -help to see options 
....
&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Most commands print help when invoked w/o parameters.&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Now once you have confirmed the above run as below &lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;# su - hdfs
$ hdfs lsSnapshottableDir 
output ..........................
drwxr-xr-x 0 mudassar hdfs 0 2018-03-15 10:38 1 65536 /user/mudassar/snapdemo &lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;That the directory I created to reproduce your issues on my cluster.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 21:43:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176146#M138401</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-03-15T21:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176147#M138402</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/1271/sheltong.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Geoffrey Shelton Okot&lt;/A&gt; &lt;BR /&gt;I have successfully created and recover snapshot directory. &lt;BR /&gt;Please see the below screen : &lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="62935-snapshotdir.jpg" style="width: 588px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19719i3E04975E20630DC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="62935-snapshotdir.jpg" alt="62935-snapshotdir.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;and another question is : &lt;BR /&gt;For example if do not remembered the snapshot details number which is something like that &lt;STRONG&gt;"&lt;/STRONG&gt;&lt;STRONG&gt;s20180316-053628.936" ? &lt;BR /&gt;&lt;/STRONG&gt;is the another way to recover the snapshot without this detail  ? &lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 10:00:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/176147#M138402</guid>
      <dc:creator>Learner_1122</dc:creator>
      <dc:date>2019-08-18T10:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create &amp; recover a snapshot</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/296957#M218515</link>
      <description>&lt;P&gt;Hi shelton,&lt;/P&gt;&lt;P&gt;please write me the command that&amp;nbsp;&lt;SPAN&gt;recovers snapshot data in such a way by retaining its ownership,timestamp,permissions and acls.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Looking forward to hear from you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 06:45:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-recover-a-snapshot/m-p/296957#M218515</guid>
      <dc:creator>Muhammad_Waqas1</dc:creator>
      <dc:date>2020-06-01T06:45:40Z</dc:date>
    </item>
  </channel>
</rss>

