Snapshots:Example: Difference between revisions

From UMIACS
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Note that in this example, 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 virtual environment 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>
sattwood@zaphod:~/virtualenv$ pwd
username@host:~/virtualenv$ pwd
/nfshomes/sattwood/virtualenv
/nfshomes/username/virtualenv
</pre>
</pre>
I see that I have a python file called  '''virtualenv.py'''.
 
A Python file named '''virtualenv.py''' exists in the directory.
<pre>
<pre>
sattwood@zaphod:~/virtualenv$ ls
username@host:~/virtualenv$ ls
appveyor.yml  bin              docs        MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
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
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst  setup.cfg  tests    virtualenv_embedded  virtualenv_support
</pre>
</pre>
<pre>
<pre>
sattwood@zaphod:~/virtualenv$ ls -lah virtualenv.py
username@host:~/virtualenv$ ls -lah virtualenv.py
-rwxrwxr-x. 1 sattwood sattwood 98K Jun 12 13:54 virtualenv.py
-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>
sattwood@zaphod:~/virtualenv$ rm virtualenv.py
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>
sattwood@zaphod:~/virtualenv$ ls
username@host:~/virtualenv$ ls
appveyor.yml  bin              docs        MANIFEST.in  scripts    setup.py  tox.ini              virtualenv_support
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
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst  setup.cfg  tests    virtualenv_embedded
</pre>
</pre>
I am going to go into the most recent hourly snapshot, in this case: '''hourly_2018_06_15__12_00'''
 
Change directory into the most recent weekly snapshot.  In this case, it's '''Weekly_nfshomes_2024-06-23_00:00'''.
<pre>
<pre>
sattwood@zaphod:~/virtualenv$ ls .snapshots
username@host:~/virtualenv$ ls /nfshomes/username/.snapshot
daily_2018_06_13__00_00 hourly_2018_06_14__04_00 hourly_2018_06_14__16_00 hourly_2018_06_15__08_00
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
daily_2018_06_14__00_00 hourly_2018_06_14__08_00 hourly_2018_06_14__20_00 hourly_2018_06_15__12_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
daily_2018_06_15__00_00 hourly_2018_06_14__12_00 hourly_2018_06_15__04_00
nfshomes_2024-06-26_12:00 nfshomes_2024-06-27_00:00 nfshomes_2024-06-27_12:00
sattwood@zaphod:~/virtualenv$ cd .snapshots/hourly_2018_06_15__12_00/
</pre>
</pre>
As you can see the file is still here.
<pre>
<pre>
sattwood@zaphod:~/virtualenv/.snapshots/hourly_2018_06_15__12_00$ ls
username@host:~/virtualenv$ cd /nfshomes/username/.snapshot/Weekly_nfshomes_2024-06-23_00\:00/virtualenv
</pre>
 
The file still exists in the snapshot.
<pre>
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
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
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst  setup.cfg  tests    virtualenv_embedded  virtualenv_support
</pre>
</pre>
I copy it back to the original directory.
 
Copy the file back to the original directory.
<pre>
<pre>
sattwood@zaphod:~/virtualenv/.snapshots/hourly_2018_06_15__12_00$ cp virtualenv.py /nfshomes/sattwood/virtualenv/
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>
sattwood@zaphod:~/virtualenv/.snapshots/hourly_2018_06_15__12_00$ cd /nfshomes/sattwood/virtualenv/
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>
sattwood@zaphod:~/virtualenv$ ls
username@host:~/virtualenv$ ls
appveyor.yml  bin              docs        MANIFEST.in  scripts    setup.py  tox.ini              virtualenv.py
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
AUTHORS.txt  CONTRIBUTING.rst  LICENSE.txt  README.rst  setup.cfg  tests    virtualenv_embedded  virtualenv_support
</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