arch linux raid0,[daily][archlinux][mdadm][RAID] 软RAID

一, 使用mdadm创建RAID

参考:https://wiki.archlinux.org/index.php/RAID

1.  安装 mdadm

/home/tong [tong@TStation] [17:47]> pacman -Ss mdadm

core/mdadm 4.0-1 (base) [installed]

A toolfor managing/monitoring Linux md device arrays, also known as Software RAID

2.  给单盘分区

2.1  GPT分区。

2.2  做好有分区,虽然裸盘也可以。

2.3  分区尾部预留100M的空余,因为:

Even hard drives of the same manufacturer and model can have small size differences. By leaving a little space at the end of the disk unallocated one can

compensate for the size differences between drives, which makes choosing a replacement drive model easier. Therefore, it is good practice to leave

about 100 MB of unallocated space at the end of the disk.

(parted) print free

Model: ATA WDC WD3000FYYZ-0(scsi)

Disk/dev/sdc: 3001GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name Flags17.4kB 1049kB 1031kB Free Space11049kB 3000GB 3000GB xfs

3000GB 3001GB 105MB Free Space

(parted) print

Model: ATA WDC WD3000FYYZ-0(scsi)

Disk/dev/sdd: 3001GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name Flags1 1049kB 3000GB 3000GB

3.  使用mdadm制作RAID

/home/tong [tong@TStation] [19:53]> sudo mdadm --create --verbose --level=1 --metadata=1.2 --raid-devices=2 /dev/md0 /dev/sdc1 /dev/sdd1

mdadm: sizesetto 2930030976K

mdadm: automatically enabling write-intent bitmap on large array

mdadm: array/dev/md0 started.

4. 后续详细设置参考:

https://wiki.archlinux.org/index.php/RAID#Installation

二, 使用lvm创建RAID

https://wiki.archlinux.org/index.php/LVM#RAID

0. 使用parted分区。

/home/tong [tong@TStation] [12:26]> sudo parted /dev/sdc print

Model: ATA WDC WD3000FYYZ-0(scsi)

Disk/dev/sdc: 3001GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name Flags12097kB 3000GB 3000GB/home/tong [tong@TStation] [12:26]> sudo parted /dev/sdd print

Model: ATA WDC WD3000FYYZ-0(scsi)

Disk/dev/sdd: 3001GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number Start End Size File system Name Flags1 2097kB 3000GB 3000GB

1.  创建物理卷

/home/tong [tong@TStation] [12:28]> sudo pvcreate /dev/sdc1 /dev/sdd1

Physical volume"/dev/sdc1"successfully created.

Physical volume"/dev/sdd1" successfully created.

2. 创建卷组

/home/tong [tong@TStation] [12:28]> sudo vgcreate VG_storage /dev/sdc1 /dev/sdd1

Volume group"VG_storage" successfully created

3. 创建逻辑卷

more information: https://jlk.fjfi.cvut.cz/arch/manpages/man/lvmraid.7

How LV data blocks are placed onto PVs is determined by the RAID level.

RAID levels are commonly referred to as 'raid' followed by a number, e.g. raid1, raid5 or raid6.

/home/tong [tong@TStation] [12:59]> sudo lvcreate --type raid1 -l 100%FREE -n storage_raid1 VG_storage /dev/sdc1 /dev/sdd1

Logical volume"storage_raid1" created.

/home/tong [tong@TStation] [13:00]> sudo lvs -o name,segtype,size

LV Type LSize

storage_raid1 raid1<2.73t

4.  创建文件系统

/home/tong [tong@TStation] [13:04]> sudo mkfs.xfs /dev/VG_storage/storage_raid1

meta-data=/dev/VG_storage/storage_raid1 isize=512 agcount=4, agsize=183105024blks= sectsz=512 attr=2, projid32bit=1

= crc=1 finobt=1, sparse=0, rmapbt=0, reflink=0data= bsize=4096 blocks=732420096, imaxpct=5

= sunit=0 swidth=0blks

naming=version 2 bsize=4096 ascii-ci=0 ftype=1log=internal log bsize=4096 blocks=357627, version=2

= sectsz=512 sunit=0 blks, lazy-count=1realtime=none extsz=4096 blocks=0, rtextents=0

5。 挂载

/home/tong [tong@TStation] [13:10]> tail -n 3 /etc/fstab

#/dev/mapper/VG_storage-storage_raid1

UUID=c5b048a0-b376-4a00-9a6f-9a9e418d982b /home/tong/Storage xfs rw,relatime,attr2,inode64,noquota 0 2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值