Snapshots:Example: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
No edit summary
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Note that in this example, the the directory ".snapshot" could also be either ".snapshots" or ".zfs/snapshot" depending on the filer serving your host. Just look for one of these three when you use the "ls -a" command.
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.


----
----


Changing to my quotes directory.
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.
 
<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      docs         scripts    tox.ini
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
AUTHORS.txt      LICENSE.txt  setup.cfg  virtualenv_embedded
dlt_quote.pdf          Quote_367512608.html        soleSource.pdf
bin              MANIFEST.in  setup.py  virtualenv.py
dy1014.xls            Quote_367884529.html        UMD_008.xls
CONTRIBUTING.rst  README.rst   tests      virtualenv_support
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>
<pre>
[derek@novelty quotes]$ rm redhat_sole_source_2007.doc
username@host:~/virtualenv$ rm virtualenv.py
</pre>
</pre>
As you can see it no longer is there.
 
Verify that the file is removed.
<pre>
<pre>
[derek@novelty quotes]$ ls  
username@host:~/virtualenv$ ls
dlt_pdf_quote2007.pdf Quote_250530976.html Quote_367884529.html  UMD_008.xls
appveyor.yml CONTRIBUTING.rst MANIFEST.in  setup.cfg tox.ini
dlt_pdf_quote.pdf      Quote_300086759.html redhat_solesource.pdf
AUTHORS.txt  docs              README.rst  setup.py  virtualenv_embedded
dlt_quote.pdf          Quote_353511914.html  soleSource2007.pdf
bin          LICENSE.txt      scripts      tests      virtualenv_support
dy1014.xls            Quote_367512608.html  soleSource.pdf
</pre>
</pre>
I am going to go into the last hourly snapshot '''hourly.0'''
 
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]$ cd .snapshot/hourly.0
username@host:~/virtualenv$ ls /nfshomes/username/.snapshot
nfshomes_2024-06-25_00:00  nfshomes_2024-06-27_04:00
nfshomes_2024-06-26_00:00  nfshomes_2024-06-27_08:00
nfshomes_2024-06-26_12:00  nfshomes_2024-06-27_12:00
nfshomes_2024-06-26_16:00  Weekly_nfshomes_2024-06-16_00:00
nfshomes_2024-06-26_20:00  Weekly_nfshomes_2024-06-23_00:00
nfshomes_2024-06-27_00:00
</pre>
</pre>
As you can see the quote is still here.
<pre>
<pre>
[derek@novelty hourly.0]$ ls
username@host:~/virtualenv$ cd /nfshomes/username/.snapshot/Weekly_nfshomes_2024-06-23_00\:00/virtualenv
dlt_pdf_quote2007.pdf  Quote_300086759.html        redhat_solesource.pdf
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
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.
 
The file still exists in the snapshot.
<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$ ls
appveyor.yml      docs        scripts    tox.ini
AUTHORS.txt      LICENSE.txt  setup.cfg  virtualenv_embedded
bin              MANIFEST.in  setup.py  virtualenv.py
CONTRIBUTING.rst  README.rst  tests      virtualenv_support
</pre>
</pre>
Copy the file back to the original directory.
<pre>
username@host:~/.snapshot/Weekly_nfshomes_2024-06-23_00:00/virtualenv$ cp virtualenv.py /nfshomes/username/virtualenv/
</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      docs         scripts    tox.ini
dlt_pdf_quote.pdf      Quote_353511914.html        soleSource2007.pdf
AUTHORS.txt      LICENSE.txt  setup.cfg  virtualenv_embedded
dlt_quote.pdf          Quote_367512608.html        soleSource.pdf
bin              MANIFEST.in  setup.py  virtualenv.py
dy1014.xls            Quote_367884529.html        UMD_008.xls
CONTRIBUTING.rst  README.rst   tests      virtualenv_support
Quote_250530976.html   redhat_sole_source_2007.doc
</pre>
</pre>


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

Latest revision as of 20:01, 16 September 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      docs         scripts    tox.ini
AUTHORS.txt       LICENSE.txt  setup.cfg  virtualenv_embedded
bin               MANIFEST.in  setup.py   virtualenv.py
CONTRIBUTING.rst  README.rst   tests      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  CONTRIBUTING.rst  MANIFEST.in  setup.cfg  tox.ini
AUTHORS.txt   docs              README.rst   setup.py   virtualenv_embedded
bin           LICENSE.txt       scripts      tests      virtualenv_support

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-27_04:00
nfshomes_2024-06-26_00:00  nfshomes_2024-06-27_08:00
nfshomes_2024-06-26_12:00  nfshomes_2024-06-27_12:00
nfshomes_2024-06-26_16:00  Weekly_nfshomes_2024-06-16_00:00
nfshomes_2024-06-26_20:00  Weekly_nfshomes_2024-06-23_00:00
nfshomes_2024-06-27_00: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      docs         scripts    tox.ini
AUTHORS.txt       LICENSE.txt  setup.cfg  virtualenv_embedded
bin               MANIFEST.in  setup.py   virtualenv.py
CONTRIBUTING.rst  README.rst   tests      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      docs         scripts    tox.ini
AUTHORS.txt       LICENSE.txt  setup.cfg  virtualenv_embedded
bin               MANIFEST.in  setup.py   virtualenv.py
CONTRIBUTING.rst  README.rst   tests      virtualenv_support