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

项目要上线,买了几台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

18同行回答

drivehqdrivehq  系统工程师 , 东华软件,dhcc
回复 3# yhsih     机器上有RAID卡,最好不重装系统做成RIAD。显示全部
回复 3# yhsih


    机器上有RAID卡,最好不重装系统做成RIAD。收起
系统集成 · 2014-06-03
浏览3399
798683133yj798683133yj  系统架构师 , 政务云某公司
看看这样行不?1. 新建一个lv,同时做镜像。 Lvcreate –m 1 –L 16 –n datavol vg01  --- 默认会指定在下一个空闲的pv disk作为镜像盘 2. 为已存在的lv,做镜像 Lvextend –m 1 /dev/vg01/datavol 3. 指定disk作为镜像盘 Lvextend –m 1 /dev/vg01/datavol /dev/d...显示全部
看看这样行不?

1. 新建一个lv,同时做镜像。
Lvcreate –m 1 –L 16 –n datavol vg01  --- 默认会指定在下一个空闲的pv disk作为镜像盘
2. 为已存在的lv,做镜像
Lvextend –m 1 /dev/vg01/datavol 3. 指定disk作为镜像盘
Lvextend –m 1 /dev/vg01/datavol /dev/disk/disk2
Lvextend –m 2 /dev/vg01/datavol /dev/disk/disk3  ---指定disk3作为第二个镜像盘。
4. 批量做镜像
Lvextend –s –m 1 /dev/vg01/data1vol
Lvextend –s –m 1 /dev/vg01/data2vol  ---   -s参数为11.31系统特有,意为不立即同步镜像。
Lvsync –T /dev/vg01/data[12]vol    ---同步镜像  vgsync则是同步vg中所有未同步的lv mirro 5. 移除镜像
Lvreduce –m 0 /dev/vg01/datavol
Lvreduce –m 0 /dev/vg01/datavol /dev/disk/disk2 –移除指定镜像盘上的镜像收起
金融其它 · 2014-06-05
浏览3421
phanxphanx  系统工程师 , 银行
有RAID卡就用RAID卡。 建议重装, 将数据备个份,重装也就是半个小时的事情。显示全部
有RAID卡就用RAID卡。 建议重装, 将数据备个份,重装也就是半个小时的事情。收起
银行 · 2014-06-03
浏览3350
drivehqdrivehq  系统工程师 , 东华软件,dhcc
回复 5# phanx   是的。。显示全部
回复 5# phanx


  是的。。收起
系统集成 · 2014-06-03
浏览3448
cwnlinuxcwnlinux  系统工程师 , CCSU
RAIDER------Description:------------Raider is a tool to automate linux software raid conversion.License: --------GPLv2Skills in the present version (0.13.2):--------------------------------------1 - Converts a single linux system disk in to a softwar...显示全部
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
浏览5573
forrest_maxuforrest_maxu  系统工程师 , 南大通用
这样linux就可以取代小机lvm这个功能显示全部
这样linux就可以取代小机lvm这个功能收起
互联网服务 · 2014-06-05
浏览5341
forrest_maxuforrest_maxu  系统工程师 , 南大通用
上述方法,对数据盘是有效果,对系统盘不行,我一直在寻求这个解决方案显示全部
上述方法,对数据盘是有效果,对系统盘不行,我一直在寻求这个解决方案收起
互联网服务 · 2014-06-05
浏览3848
cwnlinuxcwnlinux  系统工程师 , CCSU
RAID卡也有单点用Linux的mdadm来做  跟小机的mirrorvg是一样的原理显示全部
RAID卡也有单点

用Linux的mdadm来做  跟小机的mirrorvg是一样的原理收起
互联网服务 · 2014-06-03
浏览3266
yhsihyhsih  系统运维工程师 , 某网络公司
你留下的链接用的是RAID卡,看看你们的机器上有没有配置显示全部
你留下的链接用的是RAID卡,看看你们的机器上有没有配置收起
零售/批发 · 2014-06-03
浏览3341
yhsihyhsih  系统运维工程师 , 某网络公司
用linux LVM管理可以实现显示全部
用linux LVM管理可以实现收起
零售/批发 · 2014-06-03
浏览3413

提问者

drivehq
系统工程师东华软件,dhcc
擅长领域: 服务器备份Power服务器

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2014-06-03
  • 关注会员:4 人
  • 问题浏览:20349
  • 最近回答:2020-04-13
  • X社区推广