Linux note0x01
来源:互联网 发布:log4j linux 绝对路径 编辑:程序博客网 时间:2024/06/03 13:03
RAID & LVM
RAID
RAID
- RAID0
RAID0 splits (“stripes”) data evenly across two or more disks, without parity information, redundancy, or fault tolerance.
- RAID1
RAID 1 consists of an exact copy (or mirror) of a set of data on two or more disks; a classic RAID 1 mirrored pair contains two disks.
- RAID5
RAID 5 consists of block-level striping with distributed parity. Unlike in RAID 4, parity information is distributed among the drives. It requires that all drives but one be present to operate. Upon failure of a single drive, subsequent reads can be calculated from the distributed parity such that no data is lost. RAID 5 requires at least three disks
- RAID1+0
RAID 01, also called RAID 0+1, is a RAID level using a mirror of stripes, achieving both replication and sharing of data between disks.
Mdadm command
Example: RAID1+0
mdadm -Cv /dev/md0 -a yes -n 4 -l 10 /dev/sdb /dev/sdc /dev/sdd /dev/sde
C create a RAID card
v verbose, display the process
a automanticly create dev file
n number of use disk
l plan 10 means RAID1+0
formatting:
mkfs.ext4 /dev/md0
mkdir /RAID
&mount /dev/md0 /RAID
&df -h
mdadm -D /dev/md0
view the detail info
Damage to Disk Array & Repair
Simulate dev damage:
mdadm /dev/md0 -f /dev/sdb
RAID 1+0: It will not be effected if only one RAID disk failed. Just use mdadm to replace it.
umount /RAID
every operation about raid umount firstmadam /dev/md0 -a /dev/sdb
add new /dev/sdb
Disk Array + backup-disk
Extrame:Both of disk from RAID 1 were damaged.
Solution: backup-disk
mdadm -Cv /dev/md0 -n 3 -l 5 -x 1 /dev/sdb /dev/sdc /dev/sdd /dev/sde
- x backup-disk /dev/sde
LVM: Logical Volume Manager
Note: extend or shrink volume
Deploy
support /sdb & /sdc with lvm
pvcreate /dev/sdb /dev/sdc
Add both of them into storage and check them
vgcreate storage /dev/sdb /dev/sdc
&vgdisplay
split a logical volume dev about 150MB size
lvcreate -n vo -l 37 storage
&lvdisplay
formatting and mount it to use.
mkdfs.ext4 /dev/storage/vo
&mount /dev/storage/vo /mountDir
check info and make it effect permantly
echo "/dev/storage/vo /mountDir ext4 defaults 0 0" >> /etc/fstab
Extend logical volume
umount /mountDir
before extend umount itlvextend -L 290M /dev/storgage/vo
extend it to 290MBCheck disk intergrity
e2fsck -f /dev/storage/vo
Resize disk
resize2fs /dev/storage/vo
Remount and df -h
Shrink logical volume
umount /mountDir
before shrink umount ite2fsck -f /dev/storage/vo
check sys intergrityresize2fs /dev/storage/vo 120M
shrink it to 120MBRemount
mount -a
&df -h
Snapshot
View volume group
vgdisplay
lvcreate -L 120M -s -n SNAP /dev/storage/vo
s:create a snap group
L: size
Do something…
umount /mountDir
&lvconvert --merge /dev/storage/SNAP
Recover operation(will be deleted after that)
LVM Delete
umount /mountDir
&vim /etc/fstab
lvremove /dev/storage/vo
delete logical devvgremove storage
delete volume grouppvremove /dev/sdb /dev/sdc
delete physics group dev
- Linux note0x01
- linux
- linux
- Linux
- Linux
- LINUX!
- Linux
- linux
- linux
- linux
- Linux
- linux
- linux
- linux
- linux
- Linux
- linux
- linux
- 想创业,想做个物业问题跟踪系统(业主宝)
- 形式语言与自动机_笔记整理(二)
- wampservice无法安装的处理方法
- 如何快速导入发票清单,开票清单批量导入方法探讨
- Java Scanner的简单应用
- Linux note0x01
- 18.dubbo引用配置缓存、线程栈自动dump、netty4支持
- Android源码在线查看网站
- 全排列
- 【Webpack】3.多入口设置与 html-webpack-pugin 插件详解
- 前端知识体系及一些细碎的叨叨叨
- Android样式开发之你应该学会的layer-list!
- Python中datetime.timedelta的应用
- maven