Mdadm: различия между версиями
Перейти к навигации
Перейти к поиску
FireWolf (обсуждение | вклад) |
FireWolf (обсуждение | вклад) |
||
(не показаны 2 промежуточные версии этого же участника) | |||
Строка 4: | Строка 4: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2 | mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2 | ||
</syntaxhighlight> | |||
= Grow = | |||
<syntaxhighlight> | |||
mdadm --grow /dev/md2 --level=1 --raid-devices=3 --add /dev/sdc2 | |||
</syntaxhighlight> | |||
= Remove disk = | |||
<syntaxhighlight> | |||
mdadm --grow /dev/md2 --level=1 --raid-devices=2 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Строка 15: | Строка 27: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
mdadm /dev/md0 --remove /dev/hde1 | mdadm /dev/md0 --remove /dev/hde1 | ||
<syntaxhighlight> | </syntaxhighlight> | ||
= Copy via tar = | = Copy via tar = | ||
Строка 21: | Строка 33: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
tar cf - . | (cd /work/bkup/jane && tar xBf -) | tar cf - . | (cd /work/bkup/jane && tar xBf -) | ||
</syntaxhighlight> | |||
= RO mount alone raid1 partition = | |||
Search for data offset - "Data Offset : 264192 sectors": | |||
<syntaxhighlight> | |||
# mdadm --examine /dev/sdd2 | |||
/dev/sdd2: | |||
Magic : a92b4efc | |||
Version : 1.2 | |||
Feature Map : 0x1 | |||
Array UUID : 1d5e7657:671add91:63af10f2:badb68a1 | |||
Name : DESKTOP:2 (local to host DESKTOP) | |||
Creation Time : Wed Sep 7 22:01:17 2022 | |||
Raid Level : raid1 | |||
Raid Devices : 2 | |||
Avail Dev Size : 1154033664 sectors (550.29 GiB 590.87 GB) | |||
Array Size : 577016832 KiB (550.29 GiB 590.87 GB) | |||
Data Offset : 264192 sectors | |||
Super Offset : 8 sectors | |||
Unused Space : before=264112 sectors, after=0 sectors | |||
State : clean | |||
Device UUID : 59c97053:db64e186:4dcd2221:34d6ee1a | |||
Internal Bitmap : 8 sectors from superblock | |||
Update Time : Sat Oct 1 18:56:32 2022 | |||
Bad Block Log : 512 entries available at offset 16 sectors | |||
Checksum : 11f0755f - correct | |||
Events : 5610 | |||
Device Role : Active device 1 | |||
Array State : AA ('A' == active, '.' == missing, 'R' == replacing) | |||
</syntaxhighlight> | |||
mount loop device with (data offset*512): | |||
<syntaxhighlight> | |||
root@DESKTOP:/home/sasha# losetup --find --show --read-only --offset $((264192*512)) /dev/sdd2 | |||
/dev/loop22 | |||
</syntaxhighlight> | |||
Check if fs is clean: | |||
<syntaxhighlight> | |||
# fsck.ext3 -n -v /dev/loop22 | |||
e2fsck 1.46.5 (30-Dec-2021) | |||
MIRROR2: clean, 21243/36069376 files, 100445536/144254208 blocks | |||
<syntaxhighlight> | |||
mount fs in RO mode: | |||
<syntaxhighlight> | |||
# mount -o ro /dev/loop22 /mnt/mirror2/ | |||
</syntaxhighlight> | </syntaxhighlight> |
Текущая версия на 19:08, 1 октября 2022
Create
mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
Grow
mdadm --grow /dev/md2 --level=1 --raid-devices=3 --add /dev/sdc2
Remove disk
mdadm --grow /dev/md2 --level=1 --raid-devices=2
Remove from array
1. fail
mdadm /dev/md0 --fail /dev/hde1
2. remove
mdadm /dev/md0 --remove /dev/hde1
Copy via tar
tar cf - . | (cd /work/bkup/jane && tar xBf -)
RO mount alone raid1 partition
Search for data offset - "Data Offset : 264192 sectors":
# mdadm --examine /dev/sdd2
/dev/sdd2:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : 1d5e7657:671add91:63af10f2:badb68a1
Name : DESKTOP:2 (local to host DESKTOP)
Creation Time : Wed Sep 7 22:01:17 2022
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 1154033664 sectors (550.29 GiB 590.87 GB)
Array Size : 577016832 KiB (550.29 GiB 590.87 GB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=0 sectors
State : clean
Device UUID : 59c97053:db64e186:4dcd2221:34d6ee1a
Internal Bitmap : 8 sectors from superblock
Update Time : Sat Oct 1 18:56:32 2022
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : 11f0755f - correct
Events : 5610
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
mount loop device with (data offset*512):
root@DESKTOP:/home/sasha# losetup --find --show --read-only --offset $((264192*512)) /dev/sdd2
/dev/loop22
Check if fs is clean:
# fsck.ext3 -n -v /dev/loop22
e2fsck 1.46.5 (30-Dec-2021)
MIRROR2: clean, 21243/36069376 files, 100445536/144254208 blocks
<syntaxhighlight>
mount fs in RO mode:
<syntaxhighlight>
# mount -o ro /dev/loop22 /mnt/mirror2/