Snapshots:Example: Difference between revisions

From UMIACS
Jump to navigation Jump to search
(Created page with "An example: Changing to my quotes directory. <pre> [derek@novelty quotes]$ pwd /nfshomes/derek/work/quotes </pre> I see that i have a quote called '''redhat_sole_source_2007...")
 
No edit summary
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
An example:
Note that in this example, the directory '''.snapshot''' could also be '''.zfs/snapshot''' depending on the filer serving your host. You can try to <code>ls -l</code> one and if it doesn't exist, try the other.
 
----
 
For this example, the user is logged into '''host''' with the username '''username''', and a virtual environment directory named '''virtualenv''' exists in the home directory.


Changing to my quotes directory.
<pre>
<pre>
[derek@novelty quotes]$ pwd
username@host:~/virtualenv$ pwd
/nfshomes/derek/work/quotes
/nfshomes/username/virtualenv
</pre>
</pre>
I see that i have a quote called  '''redhat_sole_source_2007.doc'''.
 
A Python file named '''virtualenv.py''' exists in the directory.
<pre>
<pre>
[derek@novelty quotes]$ ls
username@host:~/virtualenv$ ls
dlt_pdf_quote2007.pdf Quote_300086759.html         redhat_solesource.pdf
appveyor.yml bin              docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests    virtualenv_embedded  virtualenv_support
dlt_quote.pdf          Quote_367512608.html        soleSource.pdf
dy1014.xls            Quote_367884529.html        UMD_008.xls
Quote_250530976.html   redhat_sole_source_2007.doc
</pre>
</pre>
<pre>
<pre>
[derek@novelty quotes]$ ls -la redhat_sole_source_2007.doc
username@host:~/virtualenv$ ls -lah virtualenv.py
-rw-r--r-- 1 derek derek 39936 Jan 23  2007 redhat_sole_source_2007.doc
-rwxrwxr-x. 1 username username 98K Jun 12 13:54 virtualenv.py
</pre>
</pre>
I will remove it from the current file system.
 
Remove it from the current working directory.
<pre>
username@host:~/virtualenv$ rm virtualenv.py
</pre>
 
Verify that the file is removed.
<pre>
<pre>
[derek@novelty quotes]$ rm redhat_sole_source_2007.doc
username@host:~/virtualenv$ ls
appveyor.yml  bin              docs        MANIFEST.in  scripts    setup.py  tox.ini              virtualenv_support
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst  setup.cfg  tests    virtualenv_embedded
</pre>
</pre>
As you can see it no longer is there.
 
Change directory into the most recent weekly snapshot.  In this case, it's '''Weekly_nfshomes_2024-06-23_00:00'''.
<pre>
<pre>
[derek@novelty quotes]$ ls  
username@host:~/virtualenv$ ls /nfshomes/username/.snapshot
dlt_pdf_quote2007.pdf Quote_250530976.html Quote_367884529.html  UMD_008.xls
nfshomes_2024-06-25_00:00  nfshomes_2024-06-26_16:00 nfshomes_2024-06-27_04:00 Weekly_nfshomes_2024-06-16_00:00
dlt_pdf_quote.pdf      Quote_300086759.html redhat_solesource.pdf
nfshomes_2024-06-26_00:00  nfshomes_2024-06-26_20:00  nfshomes_2024-06-27_08:00 Weekly_nfshomes_2024-06-23_00:00
dlt_quote.pdf          Quote_353511914.html soleSource2007.pdf
nfshomes_2024-06-26_12:00 nfshomes_2024-06-27_00:00 nfshomes_2024-06-27_12:00
dy1014.xls            Quote_367512608.html soleSource.pdf
</pre>
</pre>
I am going to go into the last hourly snapshot '''hourly.0'''
<pre>
<pre>
[derek@novelty quotes]$ cd .snapshot/hourly.0
username@host:~/virtualenv$ cd /nfshomes/username/.snapshot/Weekly_nfshomes_2024-06-23_00\:00/virtualenv
</pre>
</pre>
As you can see the quote is still here.
 
The file still exists in the snapshot.
<pre>
<pre>
[derek@novelty hourly.0]$ ls
username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ ls
dlt_pdf_quote2007.pdf Quote_300086759.html         redhat_solesource.pdf
appveyor.yml bin              docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests    virtualenv_embedded  virtualenv_support
dlt_quote.pdf          Quote_367512608.html        soleSource.pdf
dy1014.xls            Quote_367884529.html        UMD_008.xls
Quote_250530976.html   redhat_sole_source_2007.doc
</pre>
</pre>
I copy it back to the original directory.
 
Copy the file back to the original directory.
<pre>
<pre>
[derek@novelty hourly.0]$ cp redhat_sole_source_2007.doc /nfshomes/derek/work/quotes/
username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ cp virtualenv.py /nfshomes/username/virtualenv/
</pre>
</pre>
Change back to the original directory.
Change back to the original directory.
<pre>
<pre>
[derek@novelty hourly.0]$ cd /nfshomes/derek/work/quotes/
username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ cd /nfshomes/username/virtualenv/
</pre>
</pre>
And it is back.
 
Confirm that the file is restored from the snapshot.
<pre>
<pre>
[derek@novelty quotes]$ ls
username@host:~/virtualenv$ ls
dlt_pdf_quote2007.pdf Quote_300086759.html         redhat_solesource.pdf
appveyor.yml bin              docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests    virtualenv_embedded  virtualenv_support
dlt_quote.pdf          Quote_367512608.html        soleSource.pdf
dy1014.xls            Quote_367884529.html        UMD_008.xls
Quote_250530976.html   redhat_sole_source_2007.doc
</pre>
</pre>


[[Category:Snapshots]]
[[Category:Snapshots]]
__NOTOC__
__NOTOC__

Latest revision as of 17:13, 27 June 2024

Note that in this example, the directory .snapshot could also be .zfs/snapshot depending on the filer serving your host. You can try to ls -l one and if it doesn't exist, try the other.


For this example, the user is logged into host with the username username, and a virtual environment directory named virtualenv exists in the home directory.

username@host:~/virtualenv$ pwd
/nfshomes/username/virtualenv

A Python file named virtualenv.py exists in the directory.

username@host:~/virtualenv$ ls
appveyor.yml  bin               docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
AUTHORS.txt   CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests     virtualenv_embedded  virtualenv_support
username@host:~/virtualenv$ ls -lah virtualenv.py
-rwxrwxr-x. 1 username username 98K Jun 12 13:54 virtualenv.py

Remove it from the current working directory.

username@host:~/virtualenv$ rm virtualenv.py

Verify that the file is removed.

username@host:~/virtualenv$ ls
appveyor.yml  bin               docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv_support
AUTHORS.txt   CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests     virtualenv_embedded

Change directory into the most recent weekly snapshot. In this case, it's Weekly_nfshomes_2024-06-23_00:00.

username@host:~/virtualenv$ ls /nfshomes/username/.snapshot
nfshomes_2024-06-25_00:00  nfshomes_2024-06-26_16:00  nfshomes_2024-06-27_04:00  Weekly_nfshomes_2024-06-16_00:00
nfshomes_2024-06-26_00:00  nfshomes_2024-06-26_20:00  nfshomes_2024-06-27_08:00  Weekly_nfshomes_2024-06-23_00:00
nfshomes_2024-06-26_12:00  nfshomes_2024-06-27_00:00  nfshomes_2024-06-27_12:00
username@host:~/virtualenv$ cd /nfshomes/username/.snapshot/Weekly_nfshomes_2024-06-23_00\:00/virtualenv

The file still exists in the snapshot.

username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ ls
appveyor.yml  bin               docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
AUTHORS.txt   CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests     virtualenv_embedded  virtualenv_support

Copy the file back to the original directory.

username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ cp virtualenv.py /nfshomes/username/virtualenv/

Change back to the original directory.

username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ cd /nfshomes/username/virtualenv/

Confirm that the file is restored from the snapshot.

username@host:~/virtualenv$ ls
appveyor.yml  bin               docs         MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
AUTHORS.txt   CONTRIBUTING.rst  LICENSE.txt  README.rst   setup.cfg  tests     virtualenv_embedded  virtualenv_support