For Dedicated Server managed in the Cloud Panel

In this article, you will learn how to use your Dedicated Server's Linux rescue system to back up the data of your server.

Note

Raid Controller Management Programs

The software required to manage each RAID controller is installed by default. If necessary, you can download the software for the respective controller here:


Broadcom Hardware RAID Controller

https://www.broadcom.com/support/download-search


Dell Hardware RAID Controller

https://www.dell.com/support/home/de-de?app=products

Determine Hardware Controller Type

To check which hardware controller is installed in your server, enter the following command:

lspci|grep RAID

Example:

rescue:~# lspci|grep RAID
02:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID Tri-Mode SAS3408 (rev 01)

 

Checking the Status of the Hardware Raid

Use the commands below to access hardware raid and configuration information:

Broadcom Controller
Command Explanation
storcli64 /c0 show all Use this command to display information about the controller and configuration.
storcli64 /c0/eall/sall show Use this command to display information about the existing hard disks.
storcli64 /c0/eALL/sALL show all Use this command to display information about the the available disks and their current state (serial number,temperature etc.)
storcli /cx show eventloginfo Use this command to display the log entries.

You can find further information here:

12Gb/s MegaRAID Tri-Mode StorCLI User Guide

DELL PERC Controller
Command Explanation
perccli64 /c0/e32/s0 show all Use this command to display information about disk 0.
perccli64 /c0/e32/s1 show all Use this command to display information about disk 1.
perccli64 /c0 show Use this command to display information about the existing hard disks.
perccli /c0 show eventloginfo This command displays the log entries for controller 0.

You can find further information here:

Dell EMC PowerEdge RAID Controller CLI Reference Guide

Display Partitioning

This is how you display the partitioning:

Note

Depending on the server type and server model, the displayed partitions and logical volumes may differ.

  • To display a list of the file systems and identify the file system, enter the command df -h. The abbreviation df stands for disk free. The parameter -h allows you to display the number of occupied blocks in gigabytes, megabytes or kilobytes in a machine-readable form.

    rescue:~# df -h

    Example:

    rescue:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/root       630M  560M   71M  89% /
    devtmpfs         16G     0   16G   0% /dev
    tmpfs            16G     0   16G   0% /dev/shm
    tmpfs            16G   14M   16G   1% /run
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs            16G     0   16G   0% /sys/fs/cgroup

  • To list the existing disks, partitions and logical volumes, enter the command fdisk -l. fdisk is a command line utility for partitioning disks. This program lets you display, create or delete partitions.

    rescue:~# fdisk -l

    The following example lists information about the hard disks, partitions, and logical volumes of a server with hardware raid:

    rescue:~# fdisk -l
    Disk /dev/ram0: 640 MiB, 671088640 bytes, 1310720 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes


    Disk /dev/sda: 1.8 TiB, 1999844147200 bytes, 3905945600 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: DCBF9911-237E-47D0-BA51-D3802287C521


    Device        Start        End    Sectors  Size Type
    /dev/sda1      2048       6143       4096    2M BIOS boot
    /dev/sda2      6144   58593279   58587136   28G Linux filesystem
    /dev/sda3  58593280   78125055   19531776  9.3G Linux swap
    /dev/sda4  78125056 3905943551 3827818496  1.8T Linux LVM


    Disk /dev/mapper/vg00-usr: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes


    Disk /dev/mapper/vg00-var: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes


    Disk /dev/mapper/vg00-home: 10 GiB, 10737418240 bytes, 20971520 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Make a note of the paths of the logical volumes and partitions. In this example, the partition is /dev/sda2 and the logical volumes are /dev/mapper/vg00-usr, /dev/mapper/vg00-var, and /dev/mapper/vg00-home.

Starting Logical Volume Management Manually

Usually all logical volumes are started when the rescue system is started. If these are not active, you can start the logical volumes manually. To do this, enter the following commands:

rescue:~# pvscan
rescue:~# vgscan
rescue:~# vgchange -a y

File System Check

Before you mount the partition or logical volume, you should check the file system for consistency with a File System Check (FSCK). 

Caution

A file system check must not be performed with mounted and/or encrypted partitions, as this can result in data loss. If you check the file system of a logical volume, it must not be mounted either.

Therefore, make sure that the partition or logical volume is not mounted or encrypted before checking the file system with the File System Check.

To check a partition or logical volume using the File System Check, type the following command:

Partition

rescue:/# fsck -f /PATH/PARTITION


Logical Volume

rescue:/# fsck -f /PATH/LOGICAL_VOLUME

The following example checks the file system of the sda2 partition:

rescue:~# fsck -f /dev/sda2
fsck from util-linux 2.29.2
e2fsck 1.43.4 (31-Jan-2017)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
root: 3989/1831424 files (1.9% non-contiguous), 206934/7323392 blocks

Mount Partition or Logical Volume

To mount a partition or logical volume:

Note

Depending on the server type and server model, the displayed partitions or logical volumes may differ from each other.

  • To create the directory in which to mount the partition or logical volume, type the following command:

    rescue:/# mkdir /mnt/DIRECTORY

    Examples:

    Logical Volume

    rescue:/# mkdir /mnt/usr

    Partition

    rescue: /# mkdir /mnt/sda2

  • To mount the partition or logical volume, type the following command:

    rescue:/# mount /PATH/Partition /mnt/DIRECTORY

    or

    rescue:/# mount /PATH/LOGICAL_VOLUME /mnt/DIRECTORY

    Examples:

    Mounting a partition:

    rescue:/# mount /dev/sda2 /mnt/sda2

    Mounting a Logical Volume:

    rescue:/# mount /dev/mapper/vg00-home /mnt/home

Backing up Files

You have the following options to back up the data of your servers:

  • You save the data on your local computer using WinSCP.

  • You save the data on another server using Secure Copy.

  • You save the data on a local computer using Secure Copy.

After backing up your data, you can install a new image on the server or restore a backup of your system. Then you can copy the saved data to the server.


Backup Data to a Local Computer Using WinSCP

If you are using WinSCP to back up your data to a local computer, you can select the desired data and drag and drop it to a directory on your local computer. 


Copy data to another Server using Secure Copy

Secure Copy is an encrypted data transfer protocol based on Secure Shell. To transfer the data, enter the following command in the shell:

scp -r /PATH/LIST username@IP-ADRESS:/PATH/DESTINATION LIST

Example:

scp -r /mnt root@82.165.69.130:/home/backup


Save data from a local computer with Linux operating system

The following command allows you to save a directory located on the server to your local computer:

scp remote_username@SERVERIP:/DIRECTORY_FROM_COPY /COPY_LOCAL_DIRECTORY

Example:

[root@localhost ~]# scp root@217.160.44.208:/home /opt/backup

In the example above, the /home directory is copied to the /opt/backup directory located on the local computer.


To save a single file on your local computer, type the following command:

scp remote_username@SERVERIP:/remote/DIRECTORY_ON_THE_SERVER/FILENAME.txt /local_directory 

Example:

[root@localhost ~]# scp root@217.160.44.208:/remote/home/test.txt /TEMP 


Use the following command to copy a directory that is on your local computer to your server:

scp -r /LOKAL DIRECTORY remote_username@SERVERIP:/DIRECTORY_ON_THE_SERVER

Example:

[root@localhost ~]# scp -r /home/backup root@217.160.44.208:/home


To copy a single file, enter the following command:

scp -r /DIRECTORY/FILENAME remote_username@SERVERIP:/DIRECTORY_ON_THE_SERVER

Example:

[root@localhost ~]# scp -r /home/test.txt root@217.160.44:/home

Note

If scp is not found, you can install the program with the following command:


CentOS

[root@localhost ~]# yum install openssh-clients

Debian / Ubuntu

[root@localhost ~]# apt -y install openssh-server

Unmounting the File Systems

Before you boot the server into normal mode, you must unmount the mounted logical volumes or partitions. To do this, use the umount command.

Caution

If you restart the server with mounted file systems, data loss may occur!

To unmount the mounted logical volumes or partitions, enter the following command:

rescue:/# umount /PATH/Partition /mnt/DIRECTORY

OR

rescue:/# umount /PATH/LOGICAL_VOLUME /mnt/DIRECTORY

In the following example, a partition is unmounted:

rescue:/# umount /dev/sda2 /mnt/sda2