Working with the Linux Rescue System (Software RAID)

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

Note

How to boot your server into the Linux rescue system is explained in the following article:

Booting the Dedicated Server to the Linux Rescue System

Checking the Status of the Software RAID

To check the status of the software RAID, enter the following command in the shell:

rescue:~# cat /proc/mdstat
After entering the command, the following information is displayed, for example:

rescue:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [faulty]
md126 : active (auto-read-only) raid1 sda2[0] sdb2[2]
      29293440 blocks super 1.0 [2/2] [UU]

md127 : active (auto-read-only) raid1 sda4[0] sdb4[2]
      937699136 blocks super 1.0 [2/2] [UU]
      bitmap: 0/7 pages [0KB], 65536KB chunk

In the above example, md127 must be mounted.

Display Partitioning

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, logical volumes, and multiple devices, enter the command fdisk -l. fdisk is a command line program for partitioning hard disks. This program lets you display, create or delete partitions.

rescue:~# fdisk -l

Note

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

The following example lists information about hard disks, partitions, logical volumes, and multiple devices of a server with software 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: 447.1 GiB, 480103981056 bytes, 937703088 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
Disklabel type: gpt
Disk identifier: 857E5503-92EF-4576-B9E9-C1E9D6CB603F

Device        Start       End   Sectors   Size Type
/dev/sda1      2048      6143      4096     2M BIOS boot
/dev/sda2      6144  58593279  58587136    28G Linux RAID
/dev/sda3  58593280  78125055  19531776   9.3G Linux swap
/dev/sda4  78125056 937701375 859576320 409.9G Linux RAID

Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 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
Disklabel type: gpt
Disk identifier: 3CDA280F-70D3-4EBF-AC09-1C94C23A3BB3

Device        Start       End   Sectors   Size Type
/dev/sdb1      2048      6143      4096     2M BIOS boot
/dev/sdb2      6144  58593279  58587136    28G Linux RAID
/dev/sdb3  58593280  78125055  19531776   9.3G Linux swap
/dev/sdb4  78125056 937701375 859576320 409.9G Linux RAID

Disk /dev/md127: 28 GiB, 29996482560 bytes, 58586880 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/md126: 409.9 GiB, 440102879232 bytes, 859575936 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/mapper/vg00-usr: 10 GiB, 10737418240 bytes, 20971520 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/mapper/vg00-var: 10 GiB, 10737418240 bytes, 20971520 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/mapper/vg00-home: 10 GiB, 10737418240 bytes, 20971520 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/ram12: 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/ram8: 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/ram4: 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/ram14: 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/ram1: 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


Make a note of the paths of the logical volumes or the multiple device. In this example it is /dev/md127.

Starting the 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 logical volume or multiple device, you should check consistency of the file system using 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 or multiple device, it may also not be mounted.

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

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

Partition

rescue:/# fsck -f /PATH/PARTITION
Logical Volume

rescue:/# fsck -f /PATH/LOGICAL_VOLUME
Multiple device

rescue:/# fsck -f /PATH/MULTIPLE_DEVICE
The following example checks the file system of md127:

rescue:/# fsck -f /dev/md127
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: 4026/1831424 files (1.7% non-contiguous), 190579/7323360 blocks

Mounting a Multiple Device or a Logical Volume

  • To create the directory in which to mount the logical volume or multiple device, type the following command:
    rescue:/# mkdir /mnt/DIRECTORY_NAME
    Example:
    rescue:/# mkdir /mnt/md127

  • To mount the logical volume or multiple device, type the following command:
    rescue:/# mount /PATH/PARTITION /mnt/DIRECTORY
    Example:rescue:/# mount /dev/md127 /mnt/md127

Backing up Files

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

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

  • You save the data on another server 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

Unmounting the file systems

Before you boot the server into the normal mode, you need to unmount the mounted logical volumes or multiple devices. 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/MULTIPLE_DEVICE /mnt/DIRECTORY
or

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

In the following example a Multiple Device is unmounted:

rescue:/# mount /dev/md127 /mnt/md127