Data Recovery for Linux Cloud Servers Using Knoppix
Please use the “Print” function at the bottom of the page to create a PDF.
For Cloud Servers
If you boot your server normally, your partitions will be automatically mounted on startup so that you have access to the files. If you boot a server with the Knoppix DVD, the partitions are not automatically mounted.
In this article, you will learn how to boot a server using the Knoppix DVD and mount the partitions so that you can access the data via SSH or SFTP.
Before you mount the partitions or make any changes to the configuration of your server, we recommend that you take a snapshot for your Cloud Server. A snapshot is a temporary backup that is automatically deleted after three days. To create a snapshot, select the appropriate Cloud Server in the Cloud Panel. Then, click Actions > Create Snapshot.
Select the relevant server in the Infrastructure > Server section of the Cloud Panel.
Click on DVD Drive.
Select the Knoppix DVD in the Applications tab.
Click Load DVD and wait until the status indicator reaches 100% and turns green.
Click Actions > Restart.
Select the Software restart method and click Yes. The server will restart. Wait until the status display reaches 100% and turns green.
Click Actions > Start KVM Console. The KVM Console opens in a new tab.
Note
If you see a screen saver, click in the display area to stop it.
Click on the third icon from the left in the task bar to start the Terminal Emulator.
To obtain administrator rights, enter the following command:
knoppix@Microknoppix:~$ su
To set a password for the root user, type the following command:
root@Microknoppix:/home/knoppix# passwd
Enter the desired password and repeat it. For security reasons, please use a complex password with at least 8 characters and make sure that it contains letters, numbers and special characters.
To enable external access, run the following command:
root@Microknoppix:/home/knoppix# /etc/init.d/ssh start
To create a directory, enter the following command:
root@Microknoppix:/home/knoppix# mkdir /mnt/old
- To display the volume group to be mounted, run the following command:
root@Microknoppix:/home/knoppix# vgs
After you enter the command, information about the volume groups is displayed.
Examples: Ubuntu
root@Microknoppix:/home/knoppix# vgs
run/lvm/lvmetad.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
VG #PV #LV #SN Attr VSize VFree
vg00 1 2 0 wz--n- 79.52g 0
CentOSroot@Microknoppix:/home/knoppix# vgs
/run/lvm/lvmetad.socket: connect failed: No such file or directory
Warning: Failed to connect to lvmetad. Falling back to internal scanning.
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 79.47g 0In these examples, you will see the following volume groups:
Ubuntu
vg00
CentOS
centosDepending on the version of Linux you are using, the name of the volume group may vary.
To switch to the appropriate volume group, run the following command. Replace the VolumeGroup placeholder with the volume group that was displayed after you ran the vgs command.
root@Microknoppix:/home/knoppix# vgchange -ay VolumeGroup
Examples:
Ubunturoot@Microknoppix:/home/knoppix# vgchange -ay vg00
CentOS
root@Microknoppix:/home/knoppix# vgchange -ay centos
To determine which volume group the data is in, run the following command:
root@Microknoppix:/home/knoppix# lvdisplay
Usually, you will be shown 2 volume groups. Compare the size of the volume groups displayed after entering the vgs command with the size of the volume group displayed after entering the lvdisplay command. Use the path for the logical volume that has the appropriate or nearly appropriate size.
To mount the volume group, run the following command:
root@Microknoppix:/home/knoppix# mount VGpath /mnt/old
If you have the CentOS 8 distribution installed on your server, enter the following command:
root@Microknoppix:/home/knoppix# mount –r VGpath /mnt/old
Examples:
Ubuntu 18.04, Ubuntu 20.04, Debian 9 and Debian 10:root@Microknoppix:/home/knoppix# mount /dev/vg00/lv01 /mnt/old
CentOS 8:
root@Microknoppix:/home/knoppix# mount –r /dev/centos/root /mnt/old
Note
VGpath is the absolute directory path.
Login Details
Once the file system is mounted, you can use the following credentials to access the file system using an SSH or SFTP connection:
Host: Server IP
User: root
Password: (password you set)
Port: 22
File system path: /mnt/old
Create a Backup of the Data
To avoid data loss, you should always make a backup of your data before you repair the file system or check the configuration of the server. You can save the backup either on your local computer or on another computer.
Saving a Backup with WinSCP on a Local Computer
If you use a local computer with Windows, you can transfer the files quickly and easily using the WinSCP program. WinSCP is a graphical, open-source SFTP and FTP client for Windows.
You can download WinSCP from the following URL:
Requirements
You booted the server using the Knoppix DVD.
You have activated SSH access.
You have installed WinSCP on your computer.
Start WinSCP. The Login window opens
Enter the IP address of the server in the Host name field.
In the Username field, enter the user name root.
Enter the corresponding password in the Password field.
Click Log in. The following message is displayed: Should the connection continue and the computer key be stored in memory?
Click on Yes. The connection to the server is established. The area on the left displays the directories that are on your client. The area on the right displays the directories that are on your server.
Create a folder on your local computer. Then, select the desired files and directories on your server and copy them to the desired directory on your local computer using drag & drop.
Saving a Backup on Another Server
Requirements:
You have booted the server using the Knoppix DVD.
You have opened the KVM console.
You have activated SSH access.
Click on Terminal Emulator in the lower left corner of the taskbar, and it will open.
To copy the directory you want to back up to a specific directory that is on a different server, type the command below and replace the specified variables:
knoppix@Microknoppix:~$ sudo scp -r /Path USERNAME@IP ADDRESS:/PATH
In the following example, the files mounted in the /mnt/old directory are sent to the server with the IP address 82.165.69.130 and stored in the /opt/backup directory:
knoppix@Microknoppix:~$ sudo scp -r /mnt/old root@82.165.69.130:/opt/backup