LinuxForum.Fans
Тема

Создание программного RAID

Автор: Pol 72 сообщений 11048 просмотров
#175117

Я не совсем хорошо знаю как устанавливать его поэтому нашел статью http://www.it-mehanika.ru/index.php?option=com_content&view=article&id=61:-raid-debianubuntu-1&catid=25:the-project&Itemid=54
Сделал fdisk -l и у меня совсем другая картина чем в статье Помогите пожалуйста разобраться

Показать
root@debian:/home/pol# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007a121

Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 60802 488134657 5 Extended
/dev/sda5 32 60802 488134656 8e Linux LVM

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/dm-0: 9999 MB, 9999220736 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6211 MB, 6211764224 bytes
255 heads, 63 sectors/track, 755 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 483.6 GB, 483636805632 bytes
255 heads, 63 sectors/track, 58798 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table
root@debian:/home/pol#

а в /etc/fstab у мнея вообще фигня какая-то

Показать
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/debian-root / ext3 errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=3a90cd65-7cdc-4830-b787-f79ad159225d /boot ext2 defaults 0 2
/dev/mapper/debian-home /home ext3 defaults 0 2
/dev/mapper/debian-swap_1 none swap sw 0 0
# /dev/sdc1 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/scd0 /media/cdrom1 udf,iso9660 user,noauto 0 0
#175122

Ну в общем проделал я всё со вторым диском как в статье но чего то создание md0 не получается

Показать
root@debian:/home/pol# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x09400eaa.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

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-60801, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-60801, default 60801):
Using default value 60801

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x09400eaa

Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 83 Linux

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): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x09400eaa

Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 fd Linux raid autodetect

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

Calling ioctl() to re-read partition table.
Syncing disks.
root@debian:/home/pol# --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 dev/sda1
bash: --create: команда не найдена
root@debian:/home/pol# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 dev/sda1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: super1.x cannot open dev/sda1: No such file or directory
mdadm: dev/sda1 is not suitable for this array.
mdadm: create aborted
root@debian:/home/pol#
#175127

Снова попытался запустить md0 и тот же результат

Показать
root@debian:/home/pol# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 dev/sda1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: super1.x cannot open dev/sda1: No such file or directory
mdadm: dev/sda1 is not suitable for this array.
mdadm: create aborted
#175128

Pol, у вас разделы случайно не смонтированы?

#175129

Если посмотреть fdisk то там торчат какие-то dm скорее всего они созданы из BIOS ( там есть такая операция установить RAID комбинацией клавиш Ctrl-I при загрузке) Может их убить и снова запустить с командной строки?

Показать
fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007a121

Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 60802 488134657 5 Extended
/dev/sda5 32 60802 488134656 8e Linux LVM

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x09400eaa

Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 fd Linux raid autodetect

Disk /dev/dm-0: 9999 MB, 9999220736 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6211 MB, 6211764224 bytes
255 heads, 63 sectors/track, 755 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
#175130
i2ks написал:
Pol, у вас разделы случайно не смонтированы?

Какие разделы конкретно и что смотреть ?

#175131
Pol написал:
Какие разделы конкретно и что смотреть ?

sdb1 и sda1, что бы создать райд, разделы не должны быть смонтированы в системе, а как я понял sda1 у вас корневой раздел.

#175133
i2ks написал:
[quote=Pol]Какие разделы конкретно и что смотреть ?

sdb1 и sda1, что бы создать райд, разделы не должны быть смонтированы в системе, а как я понял sda1 у вас корневой раздел.[/quote]Да sda уменя корневой раздел и на нем стоит Дебиан Получается что в таком случае Рейд создать нельзя или есть какая-то утилита которая может помочь ?
может --metadata=0.90 как то в загрузчик вставить?

#175140
Pol написал:
Да sda  уменя корневой раздел и на нем стоит Дебиан Получается что в таком случае Рейд создать нельзя или есть какая-то утилита которая может помочь ?

How To Set Up Software RAID1 On A Running System (Incl. GRUB Configuration) (Debian Etch)

Внимательно вкуриваем документацию, а точней данную how-to :rolleyes:

#175147

Не получается этот шаг :

Показать
root@debian:/home/pol# sfdisk -d /dev/sda | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
OK

Disk /dev/sdb: 60801 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sdb1 0+ 60800 60801- 488384001 fd Linux raid autodetect
/dev/sdb2 0 - 0 0 0 Empty
/dev/sdb3 0 - 0 0 0 Empty
/dev/sdb4 0 - 0 0 0 Empty
New situation:
Units = sectors of 512 bytes, counting from 0

Device Boot Start End #sectors Id System
/dev/sdb1 * 2048 499711 497664 83 Linux
/dev/sdb2 501758 976771071 976269314 5 Extended
/dev/sdb3 0 - 0 0 Empty
/dev/sdb4 0 - 0 0 Empty
/dev/sdb5 501760 976771071 976269312 8e Linux LVM
Warning: partition 1 does not end at a cylinder boundary

sfdisk: I don't like these partitions - nothing changed.
(If you really want this, use the --force option.)
#175152

Pol, да у вас на sdb вообще какой то бардак с разделами, данная команда просто копирует таблицу разделов один в один, с одного диска на 2й, или как вариант можете использовать fdisk(если знаете как) необходимо сделать аналогичную таблицу разделов на 2м диске, в вашем случае sdb, как вариант если на sdb диске, нет ни чего, то прибейте все разделы,а потом создайте с помощью команды: sfdisk -d /dev/sda | sfdisk /dev/sdb.
И еще, почитайте доку или информацию как делается raid и с чем его едят.

#175159
i2ks написал:
Pol, да у вас на sdb вообще какой то бардак с разделами, данная команда просто копирует таблицу разделов один в один, с одного диска на 2й, или как вариант можете использовать fdisk(если знаете как) необходимо сделать аналогичную таблицу разделов на 2м диске, в вашем случае sdb, как вариант если на sdb диске, нет ни чего, то прибейте все разделы,а потом создайте с помощью команды: sfdisk -d /dev/sda | sfdisk /dev/sdb.
И еще, почитайте доку или информацию как делается raid и с чем его едят.

Я делал всё как в статье приведенной мной вначале . Как убить все разделы на sdb там у меня ничего нет. А RAID у меня стоял на этом компьютере на Windows Server 2008 так что что это такой я понятие имею :)

#175165

Только внимательней будьте, не перепутайте диски :rolleyes:

#175171
i2ks написал:
Только внимательней будьте, не перепутайте диски :rolleyes:

Убил с помощью fdisk /dev/sdb ( d-p-w) Теперь весь sdb по нулям нo

text
 sfdisk -d /dev/sda | sfdisk /dev/sdb

. дает тот же результат :lol:

Показать
Warning: partition 1 does not end at a cylinder boundary
sfdisk: I don't like these partitions - nothing changed.
(If you really want this, use the --force option.)

Здесь я думаю без этого --force никак не обойтись но куда его прописывать я не знаю
А не этот ли хвост не нравится sfdisk и вообще что это такое?

Показать
Disk /dev/dm-0: 9999 MB, 9999220736 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6211 MB, 6211764224 bytes
255 heads, 63 sectors/track, 755 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
#175179

fdisk -l /dev/sda и sdb покажите.

#175186
i2ks написал:
fdisk -l /dev/sda и sdb покажите.
Показать
root@debian:/home/pol# fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007a121

Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 60802 488134657 5 Extended
/dev/sda5 32 60802 488134656 8e Linux LVM
root@debian:/home/pol#
Показать
root@debian:/home/pol# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x09400eaa

Device Boot Start End Blocks Id System
root@debian:/home/pol#
#175192

ну как вариант поставить ключик -f (--force).

#175196
i2ks написал:
ну как вариант поставить ключик -f (--force).

Ключик вместо -d ставить?

#175197

Pol, ключик d нужен, он делает dump таблицы разделов первого диска.

Войдите или зарегистрируйтесь, чтобы ответить.