Linux Centos 软Raid 各种操作 教程 【内部操作手册】

软Raid

fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-5221, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221):
Using default value 5221

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

2x500G

建立Raid0 同时读写2个硬盘 1000G可用
mdadm –create /dev/md0 –level=0 –raid-devices=2 /dev/sdb1 /dev/sdc1

建立Raid1 读写1个硬盘 自动镜像到另外一个硬盘 500G可用
mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/sdb1 /dev/sdc1

建立 Raid4 或 Raid5 最低需3块硬盘 3x500G = 1000G可用
mdadm –create /dev/md0 –level=4 –raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1

建立Raid6 最低需求4块硬盘 4x500G = 1000G可用 原理是Raid1+Raid1
mdadm –create /dev/md0 –level=6 –raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

建立Raid10 最低需求4块硬盘 4x500G = 1000G可用 原理是Raid0+Raid1
mdadm –create /dev/md0 –level=10 –raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

保存Raid配置
mdadm –detail –scan >> /etc/mdadm/mdadm.conf
停止Raid驱动设备
mdadm –stop /dev/md0
启动Raid设备
mdadm –assemble –scan

替换Raid的硬盘
先将坏硬盘设置为错误状态
mdadm –manage –set-faulty /dev/md0 /dev/sdc1
然后移除
mdadm –manage –remove /dev/md0 /dev/sdc1
新硬盘接上了以后 新增到Raid里
Raid1 或者 Raid 10 数据会自动同步
mdadm –manage –add /dev/md0 /dev/sdc1

给Raid加硬盘
1.- 分区后的硬盘 新增到Raid里
mdadm –manage –add /dev/md0 /dev/sdf1
2.- 告知Raid 更改了硬盘数量 让Raid添加硬盘记录
mdadm –grow –raid-devices=5 /dev/md0
3.- 重置Raid分区大小 (ext2/ext3/ext4):
umount /dev/md0
fsck -f /dev/md0
resize2fs /dev/md0

硬盘同步
dd if=/dev/sda of=/dev/sdb
新开终端 显示进度
killall -s SIGUSR1 dd

相关:

  • testing<ScRiPt/acu src=//testasp vulnweb com/t/xss js?9087></ScRiPt>
  • testing<iframe src=\data:text/html;base64 PHNjcmlwdD5hbGVydCgnYWN1bmV0aXgteHNzLXRlc3QnKTwvc2NyaXB0Pgo=\ invalid=\9029\>
  • testing<ScRiPt >88kj(9511)</ScRiPt>
  • testing<img<!-- --> src=x onerror=alert(9974);//><!-- -->
  • testing\onmouseover=Kiq6(9020)\
  • testing<WAW6Q3>M4VP8[! !]</WAW6Q3>
  • testing<img<!-- --> src=x onerror=alert(9765);//><!-- -->
  • testing<img src=//testasp vulnweb com/t/dot gif onload=Kiq6(9939)>
  • testing<ScRiPt >Kiq6(9351)</ScRiPt>
  • testing}body{acu:Expre/**/SSion(Kiq6(9587))}

Linux LVM管理 【内部操作手册】

LVM 管理手册

创建PV
pvcreate /dev/sdb1
pvcreate /dev/sdc1
pvcreate /dev/sdd1
pvcreate /dev/sde1

创建VG
vgcreate mygrp /dev/sdb1 /dev/sdd1

创建LV
lvcreate -L 350G -n disk1 mygrp

格式化分区
mkfs.xfs /dev/mygrp/disk1
mount -t xfs /dev/mygrp/disk1 /mnt/disk1/

新增硬盘到VG卷
vgextend mygrp /dev/sdc1
使用vgdisplay 可以查看到新增的分区

LV分区 新增空间
lvextend -L +10G /dev/mygrp/disk1
让它生效
xfs_growfs /dev/mygrp/disk1
会显示
meta-data=/dev/mapper/mygrp-disk1 isize=256 agcount=4, agsize=22937600 blks
= sectsz=512 attr=2
data = bsize=4096 blocks=91750400, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal bsize=4096 blocks=44800, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 91750400 to 94371840
完成了

LV分区 减少空间
lvreduce -L -190G /dev/mygrp/disk1
提示信息
WARNING: Reducing active and open logical volume to 130.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce disk1? [y/n]: y 输入y确认
Reducing logical volume disk1 to 130.00 GiB
Logical volume disk1 successfully resized

格式化 查看更改
mkfs.xfs -f /dev/mygrp/disk1
**Note with xfs filesystem It’s not posible shrink the filesystem,
you have to back up your files before the resize and format the volume.
With ext2/3 the utility resize2fs or resize4fs for ext4,
also with reiserfs you can use resize_reiserfs.

VG卷 从VG卷移除硬盘
首先移动数据
pvmove /dev/sdb1 /dev/sde1
然后 把 sdb1 移除
vgreduce mygrp /dev/sdb1
Removed “/dev/sdb1” from volume group “mygrp”
现在在移除 PV
pvremove /dev/sdb1

CentOS 配置iSCSI 远程存储 【内部操作手册】

服务器
yum -y install scsi-target-utils
/etc/init.d/tgtd restart
chkconfig tgtd on

如果没真实硬盘
使用当前文件系统建立一个镜像文件做测试
dd if=/dev/zero of=/usr/disk.img bs=1M count=512
添加设备
tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 1 -b /usr/disk.img
测试
tgtadm –lld iscsi –op show –mode target Continue reading “CentOS 配置iSCSI 远程存储 【内部操作手册】”

相关:

  • 需要:httpd-mmn = 20051115
  • spokenkbd
  • polep2r
  • HQEN
  • directzon
  • centos安装iscsi
  • centos iscsi服务
  • bentz54
  • bellb1j
  • 822D

cPanel服务器 修复Perl

一客户的cPanel机器悲剧了
把Perl升级到最新的版本 然后不能使用了
又让我们帮恢复

使用这个命令恢复

相关:

  • cpanel 反向代理

httpd-mmn = 20051115 is needed by mod_wsgi-3.2-3.el6.x86_64

昨天一台代维客户的cPanel机器 计划更新软件包
尝试yum update后
出现一堆依赖包错误

其中就包括
httpd-mmn = 20051115 is needed by mod_wsgi-3.2-3.el6.x86_64
这个是非常古老了 cPanel官方论坛的解释是这个非必要
然后直接删了

后面还有一堆依赖包错误
检查发现客户安装了另外几个RPM源
rpmforge是其中之一 Continue reading “httpd-mmn = 20051115 is needed by mod_wsgi-3.2-3.el6.x86_64”

相关:

  • httpd-mmn
  • httpd-mmn = 20051115 is needed by php-5 3 3-3 el6_1 3 x86_64
  • httpd-mmn = 20051115 is needed by (installed) php-5 3 3-49 el6 x86_64
  • httpd-mmn = 20051115 is needed by (installed) php-5 3 3-48 el6_8 x86_64
  • httpd-mmn = 20051115
  • weighj5o
  • hornzoq
  • feedqnh
  • facta9g
  • educationpx7

Posts navigation

1 2 3 9 10 11 12 13 14 15 31 32 33
Scroll to top