Difference between revisions of "Backup Procedures"
Line 49: | Line 49: | ||
Step Four; Verify full system functionality as any good technician in 24PinTech should, and then your task should be complete. | Step Four; Verify full system functionality as any good technician in 24PinTech should, and then your task should be complete. | ||
==How to back up Fog images== | |||
====Installing Rsync==== | |||
Go to 10.21.25.2 and login to esxi with your id and password. Then go to fog and log into the console with the admin account. Open the terminal and run the following command to install rsync. We need to run this command as sudo to grant the user the same security privileges as the superuser. | |||
== | <code>sudo apt install rsync</code> | ||
we | ====Checking For Ssh Keys==== | ||
To automate these backups, we need to be able to login without a password by creating ssh keys. First, you should check if these already keys exist using the following command. | |||
<code>ls -al ~/.ssh/id_*.pub</code> | |||
====Creating Ssh Keys==== | |||
If the keys don't exist, they should be created using the following command. When prompted for a password press enter to set it to no password. (just hit enter at the prompt don't type anything) | |||
<code>ssh -keygen -t rsa</code> | |||
This key also needs to be on the destination so the key should be copied to Unraid. | |||
<code>ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]</code> | |||
====Automatic Rsync==== | |||
To automate rsync, we need to use cron and create a cronjob. | |||
<code>crontab -e</code> | |||
We want it to run once a month so we will set beginning part of the command to run monthly. The first part represents the minute, second is hour, third is day, fourth is month, and fifth is day of the week. | |||
<code>MM HH DD MTMT DAY command</code> | |||
Once we change it to monthly, we need to add the rsync command after. This command will use rsync to backup up the fog images to the backups folder on Unraid. | |||
<code>0 0 1 * * rsync -e 'ssh -p 22' -avp /images/ 10.21.25.13:/mnt/user0/Backups/Fog_Images/</code> | |||
This will now backup the fog images at the beginning of every month. | |||
==Old manual back up procedures== | ==Old manual back up procedures== | ||
[[Server Backup (manually)]] | [[Server Backup (manually)]] | ||
# | # |
Revision as of 20:33, 15 September 2022
How to back up Odin (10.21.25.3) and Friia (10.21.25.4) manually
This is how we back up our two Windows servers to an external drive.
- Get the external drive labelled "server backups" from the middle drawer on the left of chamberlains desk.
- Take the drive into the back room and remove the guard on the server labelled Valhalla and plug the drive into the right usb port.
- On a computer in the classroom use chrome and type "10.21.25.2" into the address bar. The log in for esxi is the same for your log in for class. (Server Admin accounts only)
- Go to virtual machines and click on "Odin" click on "Edit" and click on "Add other device" and then "USB device" select Western Digital My Passport 25E2. Press save and click on the window of the virtual machine to be taken to Odins desktop.
- Click on "Actions" and then "Guest OS" "Send Keys" and "ctrl-alt-del" and log in using your profile in class. (Server Admin accounts only)
- Use the start menu and type "Windows Server Backup" open it.
- The Snap-in on the left has the option to to perform "Local Backup" the snap in on the right has an option to backup select it and go through the menu that pops up and select the following options "Backup Once, Different options, Full server, local drive select "my passport" and hit backup.
- After backup is finished go back to 10.21.25.2 and click on Odin then "Edit" and press the small x next to the hard drive. Put the hard drive in chamberlains desk when you are finished.
- For Friia do the exact same process.
Automated Backups
The following command will create a Task Scheduler task named WeeklySystemStateBackup that runs every Saturday ( SAT ) at 19:00 (7 pm). This task will run WEEKLY with the HIGHEST privileges. It will run the Windows Server Backup CLI to backup SYSTEMSTATEBACKUP to target volume "E" (Volume E is a physical hard drive in the back on the server called "my passport")
Schtasks /Create /SC weekly /D SAT /TN WeeklySystemsStateBackup /ST 19:00 /TR “wbadmin start systemstatebackup -backupTarget: E:”
This can also be ran manually via the task scheduler.
Restore Windows Server Backup on ESXi
The following process was used to restore a backup of our production server Odin which is a active directory server with DNS, DHCP, Print, and other services. In the process you will have to use DRSM (Directory Service Restore Mode) if you are trying to restore a server running Active Directory because if you try in normal Windows mode you'll encounter an error. The restored version of the VM may encounter some errors you may have to fix but it should sort itself out. This may be just because you are restoring an older machine so whatever it's running that's synced may get confused. The following steps guide you through this process:
- Grab a backup of the Windows Server you are trying to restore
- Go to one of our ESXi machines and create a new VM with the necessary requirements for the machine you want to restore. In our case we are trying to restore a Windows Server 2019 Domain Controller so we gave it 100 GB of storage, 4 CPUs, and 8 GB of memory.
- Do basic setup of the machine and once it is installed you want to add the Windows Server Backup Feature
- Once done you have to boot the Server back into Directory Service Restore Mode (A type of safe mode.) To do this run msconfig by either right clicking the start menu or doing Win+R.
- Go over to the Boot Tab and check the following two checks, Safe mode and DSRM (Directory Service Restore Mode.) Follow the prompt and restart the computer.
- Once the computer has booted into DRSM open Windows Server Backup and run the restore command.
- Follow the prompts depending on where your backup is stored and what server you are trying to restore.
- When asked what files you want to restore, do System State if you are trying to restore an entire machine or one of the other options if you are trying to restore certain files.
- Go ahead and check the Active Directory Replication check mark and continue on.
- The restoration process should start and once done the computer will have to restart, it will restart into DRSM. You’ll have to go back into msconfig and uncheck the safe mode option and restart the computer again.
- The computer should reboot into the restored version of the machine, there may be some errors or active directory issues but those should sort themselves out. This is just because you are restoring an older version of a machine and the active directory is confused.
How to back up Logan_Web (10.21.25.11) Manually
Step One; The first and most essential step to backing up Logan_Web onto the Fog server is to register it to the Fog server itself, in order to be able to perform the process. If not already completed, this can be performed by doing a full host registration. Begin this by logging into the Fog server (http://10.21.25.29/fog) and selecting the 'Images' tab. Create a new image, and name it accordingly to what is required. Once completed, you're going to find Logan and select it. Before booting into the device, make sure to head into the 'Actions' tab near the top and choose to Edit settings. On the first tab, the Virtual Hardware, make sure that the ability to connect with the NIC is available; as this is how we'll be PXI booting. Then, head into the VM settings and expand the 'Boot Options' category. Scroll for just a moment and select the option to force the device to boot into BIOS. Once accomplished, go into the boot settings of the BIOS and move 'Ethernet' to the top of the list. Continue the booting process, and do not forget to rearrange the Boot Order at a later date. Once you are prompted with a menu, select 'Full Host Registration'
Hostname: Dev_Logan
logging into the Fog server (http://10.21.25.29/fog) and selecting the 'Hosts' tab. Search this list of servers for 'dev_logan', as this is the server we're going to be backing up. Select the 'Capture' option on 'dev_logan', and once completed, the next time that Logan is PXI booted through ethernet it'll be automatically pulled and backed up.
Step Two; Once this request to pull the image from Logan has gone through, the next step is to boot into Logan to perform the backup. Head to https://10.21.25.8/ui/#/login and logon to the ESXi device. Once completed, you're going to find Logan again and select it. Before booting into the device, make sure to head into the 'Actions' tab near the top and choose to Edit settings. On the first tab, the Virtual Hardware, make sure that the ability to connect with the NIC is available; as this is how we'll be PXI booting. Then, head into the VM settings and expand the 'Boot Options' category. Scroll for just a moment and select the option to force the device to boot into BIOS.
Step Three; When ready
Step Two; Once the request has been sent over and has gone through, you'll need to pull the image from the Fog server onto Logan. This can be done by 'Pxi Booting', as in, taking it off of the network by booting from Ethernet. By doing this, you'll be initiating the booting process in such a way that the image will begin its installation. You can 'Pxi Boot' a system by going into the boot menu while the device is starting up, and selecting the Ethernet option. The actual process of this may be more complicated, and you can get more insight into it *here*. (Possibly hyperlink to another article if existing, if not then write a short section on it here.)
Step Three; Coming to the end now, the final step in your process will be to store the image you've just used in the UnRAID Server, for future usage and documentation. This can be done by first logging into the UnRAID server and then navigating your way to
Step Four; Verify full system functionality as any good technician in 24PinTech should, and then your task should be complete.
How to back up Fog images
Installing Rsync
Go to 10.21.25.2 and login to esxi with your id and password. Then go to fog and log into the console with the admin account. Open the terminal and run the following command to install rsync. We need to run this command as sudo to grant the user the same security privileges as the superuser.
sudo apt install rsync
Checking For Ssh Keys
To automate these backups, we need to be able to login without a password by creating ssh keys. First, you should check if these already keys exist using the following command.
ls -al ~/.ssh/id_*.pub
Creating Ssh Keys
If the keys don't exist, they should be created using the following command. When prompted for a password press enter to set it to no password. (just hit enter at the prompt don't type anything)
ssh -keygen -t rsa
This key also needs to be on the destination so the key should be copied to Unraid.
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
Automatic Rsync
To automate rsync, we need to use cron and create a cronjob.
crontab -e
We want it to run once a month so we will set beginning part of the command to run monthly. The first part represents the minute, second is hour, third is day, fourth is month, and fifth is day of the week.
MM HH DD MTMT DAY command
Once we change it to monthly, we need to add the rsync command after. This command will use rsync to backup up the fog images to the backups folder on Unraid.
0 0 1 * * rsync -e 'ssh -p 22' -avp /images/ 10.21.25.13:/mnt/user0/Backups/Fog_Images/
This will now backup the fog images at the beginning of every month.