服务器没做RAID,Linux系统怎样实现数据安全?

项目要上线,买了几台PowerLinux,PowerLinux系统是默认安装着的,服务器有4块600G的硬盘,但Linux系统只安装在其中一块硬盘上,为了实现数据的安全,现有2种方案:1、做基于OS的镜像,类似与rootvg镜像一样;2、重做RAID,这样需要重做操作系统。如做基于OS的镜像,不如如何来做?Creating a RA...显示全部
项目要上线,买了几台PowerLinux,PowerLinux系统是默认安装着的,服务器有4块600G的硬盘,但Linux系统只安装在其中一块硬盘上,为了实现数据的安全,现有2种方案:1、做基于OS的镜像,类似与rootvg镜像一样;
2、重做RAID,这样需要重做操作系统。

如做基于OS的镜像,不如如何来做?


Creating a RAID disk array on PowerLinux
https://www.ibm.com/developerworks/community/blogs/fe313521-2e95-46f2-817d-44a4f27eba32/entry/configuring_the_raid_controller28?lang=en收起
参与47

查看其它 17 个回答cwnlinux的回答

cwnlinuxcwnlinux系统工程师CCSU
RAIDER
------


Description:
------------
Raider is a tool to automate linux software raid conversion.

License:
--------
GPLv2


Skills in the present version (0.13.2):
--------------------------------------
1 - Converts a single linux system disk in to a software raid 1, raid 4, raid 5, raid 6 or raid 10,
    after adding all necessary disks.
2 - List disks, partitions, lvm partitions, mountpoints and raid devices in a compact view.
3 - Erase a disk.


Minimum requirements:
---------------------
1  - mdadm package =>2.6
2  - parted package =>2.0
3  - bash =>3.0
4  - kernel =>2.6.18
5  - sfdisk
6  - hdparm
7  - rsync
8  - bc
9  - wget
10 - At least one these initramfs generator:
                dracut
                mkinitcpio
                mkinitramfs
                mkinitrd
                genkernel
Note: linux distros without intramfs generators installed are not supported.


Bootloaders supported:
----------------------
- Grub legacy
- Grub 2
- LILO (Only tested in Slackware and Vector Linux).


Partition types supported:
--------------------------
- MBR/msdos
- GPT/GUID
- (U)EFI system partition is not yet supported.
(this is expected to be supported in version 0.20)


Initramfs generators supported:
----------------------------
- dracut
- mkinitcpio
- mkinitramfs
- mkinitrd
- genkernel


Filesystems type supported:
--------------------------
Linux filesystems:
- ext2
- ext3
- ext4
- swap
- xfs
- jfs
- reiserfs
- LVM2

Note: Encrypted filesystems are not yet supported.

Target computers:
-----------------
Single disk computers with linux system only.
Mixed systems, with non-linux filesystems are not supported.

dmraid (fake raid) is also not compatible with mdraid (linux software raid),
so avoid to have both raid solutions in the same system.


HELP COMMAND (raider --help)
----------------------------

Usage:  raider [options] [Conversion options]

Examples:
raider -R1 sda sdb     # convert /dev/sda single disk to a 2 disk raid1 system
raider -R1             # if there are only two disks, don't need to name them
raider -R5 sda sdb sdc # convert /dev/sda single disk to a 3 disk raid5 system
raider -e /dev/sdb     # erase /dev/sdb disk
raider -d              # List all disks info
* (devices can be named as "/dev/sdX" or "sdX" without "/dev/")

Conversion options:
-R1,  --single-to-raid1 <...> (min: 1+1 disks)
-R4,  --single-to-raid4 <..> (min: 1+2 disks)
-R5,  --single-to-raid5 <..> (min: 1+2 disks)
-R6,  --single-to-raid6 <..> (min: 1+3 disks)
-R10, --single-to-raid10 <..> (min: 1+3 disks)
       --run            # Second command to complete the process after
                          swapping disks or after "-t" option

Options:
-t, --test             # Test -R options. Scans the system and output results
-d, --disklist         # List disks, partitions, mountpoints and raid arrays
-e, --erase    # Erase disk
-V, --version          # Print version number
-h, --help             # This help screen

Advanced Options: (Barely used. Read the manual before use them)
-s, --swapraider        # Create a raid array combining all swap partitions.
                           By default swapraider is not set, unless there is
                           a resume kernel option in the bootloader menu.
                           In this case, swapraider will be set automatically.
-l, --lvm-suffix # Chose another LVM Volume Group suffix name
-b, --boot [] []
                         # Change the size and filesystem of the automatic
                           /boot partition created by raider when needed
                           Size units in "MB" or "KB".
                           Filesystems=ext2, ext3, ext4, xfs, jfs, reiserfs
                           Default filesystem=ext2 and size=500MB

Procedure summary to convert to raid 1:
------------------------------------------------

- ** DON'T FORGET TO MAKE A BACKUP BEFORE RUNNING RAIDER. **

1 - Add the new disks to the powered off computer.
        - raid 1 needs to add 1 more disk
        - raid 4 and raid 5 need to add at least 2 more disks
        - raid 6 and raid 10 need to add at least 3 more disks
2 - The first time you are going to use raider (STEP 1), always boot in the default grub option.
3 - Login as root (in Ubuntu you may login as user and use sudo)
        You can run in graphical mode, but console mode is the preferred method.
        If you are using a server, it is better to change to runlevel 1/single mode
    (example with Raid 1):
                # raider -R1
        This will create a degraded raid system in the new disk(s).
4 - When it ends, shutdown the system and swap disks in the slots.
        The original disk must be swapped with the last disk in the slot connections.
       
5 - Turn on the system again (STEP 2).
        Some systems may not start some degraded raid arrays unless they boot in "recovery mode" or "safe mode"
        So, if you find that some raid arrays did not started as expected, reboot in "safe mode/recovery mode/single user mode",
        but generally, this is not needed.
        After login, check if it is working, and then run this command as root:
                # raider --run
        This will RaidSync the disks.

To convert to Raid 5:
- Do the same thing as in raid 1 description, but add 2 more disks, and run the command:
# raider -R5 sda sdb sdc
Continue with the steps 3 and 4 described above.

Conversion to raid 4, 6, 10 has a similar description (see "raider --help")

Notes:
----
1-Raider always use the original single disk device connected to the first slot, creating the raid system in the other disks.
Only after this is done, you may swap the first with the last disk.
Then it's the time to test the new raid system, and check if it is working as expected.
Only then, you are able sync the old disk with the new raid system.

Swapping disks:
---------------
When it is time to disk swapping, you must be sure to swap the original disk (with the non-raid system)
with the disk connected to the last slot.

This is important, because raider named their devices according to this order, and he knows the
last one will be repartitioned, re-formatted and synced to the other disks. So, if you made a mistake,
raider will not be able to proceed, but raider is clever enough to not erase the wrong disk.

Nevertheless, you will be able to fix the situation.

LVM partitions oddities
----------------------------
When creating a new Volume Group in the new raid array, we cannot name it
with the same name as it was in the original disk.

So, the name would be "oldName__raider": the old name with suffix __raider (with two underscores)
You may change this suffix with the "-l" option (see --help option)


SINGLE USER MODE
----------------
"Single user mode" or "runlevel 1" is a machine state that run as root, with no daemons running,
no network and no other users using the system.
It is a perfect state to copy all the system to another disk, knowing that nothing will be changed during the process of copying without your intervention.
If you are running a server, this is the prefered approach to use raider.
But if you want to use raider in a desktop with one only user, "single user mode" is not necessay.

OpenSuSe, must not run in "single user mode", because in this mode, raid arrays are not able to start.
So, in OpenSuse run always raider in multi-user mode.

In all other distros, if you want to change to single mode before running raider, use "telinit 1" command, or "systemctl isolate rescue.target" (if the distribution is using "systemd" instead of "SystemV").

After swapping disks, you can run "raider --run" in multiuser mode.


BOOTING IN TO A RAID SYSTEM
---------------------------

Linux is only able to boot directly in a non-raid-system. But Grub 1 and Lilo, are able
to boot in a Raid 1 device.

Recent Grub 2 versions, are already able to boot in Raid 4, 5, 6, 10, but there are some
issues, because if one drive fails, the system will not be able to boot in a 4/5/6/10 degraded array.

To go around this problem, if we are building a raid 4, 5, 6, 10 raid system, and there is not a separated boot partition, raider automatically creates one in each disk, adding these boot partitions in a raid 1 device, which allows the system to boot in this raid 1 degraded array.
The boot partition, by default will have 500MB size, and an ext2 filesystem.
If we do not agree with the default option, we can change it using "-b" option, and change to another size, and/or filesystem.

Note: New harddisks larger then 2 Terabytes, are not able to boot in raid metadata 0.90 version. This issue limits its use to Grub 2 bootloader.

TROUBLESHOOTING:
----------------
Raider was tested in a lot of different distros, with different configurations, but issues may happen.

So, do your backups before you run raider!

Raider creates some logfiles that may be useful to troubleshoot:
/var/log/raider directory, has several logfiles you can read and help to understand what happened.

If you ask for help in the forum, you can run a command named "lograider" which archives all raider logfiles in one zipped file named "lograider.tgz" that you can upload to the forum.

Don't use raider with systems using multiple disks mounted. It only mirrors the original system disk, not the others.



LINUX DISTROS TESTED SUCCESSFULL:
---------------------------------

- Arch Linux
- ArchBang
- Bodhi Linux-1.4
- Centos-5.5
- Centos-5.8
- Centos-6.0
- Centos-6.1
- Centos-6.2
- Debian-5
- Debian-6
- Fedora-13
- Fedora-14
- Fedora-15
- Fedora-16
- Fedora-17
- Gentoo
- Linux Mint Xfce Edition Debian
- Linux Mint 201204 Debian
- Linux Mint-11
- Linux Mint-12
- Linux Mint-13
- Kubuntu-12.04
- Lubuntu-10.10
- Lubuntu-11.04
- Lubuntu-11.10
- Lubuntu-12.04
- Mageia-1
- Mageia-2
- Mandriva-2010-1
- Mandriva-2010-2
- Mandriva-2011
- OpenSuSE-11.3
- OpenSuSE-11.4
- OpenSuSE-12.1
- Parabola GNU/Linux-libre
- PcLinuxOS-2010-12
- PcLinuxOS-2011-7
- PcLinuxOS-kde-2012-2
- ROSA-2012.0
- Sabayon-8
- Sabayon-9
- Scientific Linux-5.8
- Scientific Linux-6.1
- Scientific Linux-6.2
- Slackware-13.37.0
- Ubuntu-10.10-lts
- Ubuntu-11.4
- Ubuntu-11.10
- Ubuntu-12.04
- Ultimate Edition-3.2
- Xubuntu-12.04
- Vector Linux-7 (with LILO as the bootloader)


LINUX DISTROS TESTED BUT NOT SUPPORTED
--------------------------------------

- Chakra Linux-2012-02 (tested unsuccessfully)
- Mepis-11.0.12 (tested unsuccessfully)
- Vector Linux-7 with Grub 2 (tested unsuccessfully)
- (other distros not using a initramfs generator)

NOT TESTED BUT PROBABLY WORKING
-------------------------------

I think raider will be able to work in almost all "Ubuntu",
"RedHat", and "Debian" centric distros, but
they were not all tested (you know how many exist...)
I will appreciate some feedback.
Thank's!
互联网服务 · 2014-06-06
浏览5674

回答者

cwnlinux
系统工程师CCSU
擅长领域: 服务器存储灾备

cwnlinux 最近回答过的问题

回答状态

  • 发布时间:2014-06-06
  • 关注会员:4 人
  • 回答浏览:5674
  • X社区推广