Bonjour à tous,
J'ai un serveur en production, softRaid 3x2To, par défaut en RAID1.
Je n'ai pas anticipé, et le système est donc sur une unique partition RAID1 de 2To (/dev/md1). J'ai voulu "profiter" d'une défaillance d'un des disques pour modifier le schéma de partionnement.
J'ai donc sorti 2 disques du RAID, créé mes partitions sur ces 2 disques (150Go RAID1 pour ma racine /dev/md0 et le reste en RAID5 pour mes données /dev/md2). J'ai copié mon système de fichiers depuis le RAID md1 d'origine sur le nouveau RAID md0 de 150Go.
Jusque ici pas de problème, tous mes RAID fonctionnent (en dégradé mais c'est normal).
Je voudrais maintenant pouvoir redémarrer le serveur sur la nouvelle racine du système, donc sur le RAID1 de 150Go /dev/md0, afin de pouvoir appliquer le même partionnement au premier disque, et finir de reconstruire mes nouveaux RAID.
Et c'est là que je bloque, impossible de faire booter GRUB sur mon nouveau RAID1, il boote systématiquement sur /dev/md1, le RAID d'origine…
J'ai tenté du grub-install sur les 3 disques, de chrooter dans mon nouveau raid, de refaire du grub-mkconfig depuis le chroot, etc, rien n'y fait…
Voici les principaux éléments du serveur, si une âme charitable peut m'y aider..
/home/debian# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 1.8T 0 part
│ └─md1 9:1 0 1.8T 0 raid1 /
├─sda2 8:2 0 511M 0 part [SWAP]
└─sda3 8:3 0 3.1M 0 part
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 150G 0 part
│ └─md0 9:0 0 149.9G 0 raid1 /mnt/md0
├─sdb2 8:18 0 512M 0 part
└─sdb3 8:19 0 1.7T 0 part
└─md2 9:2 0 3.4T 0 raid5 /home/data
sdc 8:32 1 1.8T 0 disk
├─sdc1 8:33 1 150G 0 part
│ └─md0 9:0 0 149.9G 0 raid1 /mnt/md0
├─sdc2 8:34 1 512M 0 part
└─sdc3 8:35 1 1.7T 0 part
└─md2 9:2 0 3.4T 0 raid5 /home/data
:/home/debian# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]
md2 : active raid5 sdb3[1] sdc3[2]
3591143424 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU]
bitmap: 14/14 pages [56KB], 65536KB chunk
md0 : active raid1 sdb1[1] sdc1[2]
157155328 blocks super 1.2 [3/2] [UU]
bitmap: 2/2 pages [8KB], 65536KB chunk
md1 : active raid1 sda1[0]
1952986048 blocks [3/1] [U]
bitmap: 15/15 pages [60KB], 65536KB chunk
unused devices:
:/home/debian# fdisk -l
Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: HGST HUS724020AL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa27a9a62
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 314574847 314572800 150G fd Linux raid autodetect
/dev/sdc2 314574848 315623423 1048576 512M 82 Linux swap / Solaris
/dev/sdc3 315623424 3907029167 3591405744 1.7T fd Linux raid autodetect
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: HGST HUS726020AL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ca6006e
Device Boot Start End Sectors Size Id Type
/dev/sda1 4096 3905976319 3905972224 1.8T fd Linux raid autodetect
/dev/sda2 3905976320 3907022847 1046528 511M 82 Linux swap / Solaris
/dev/sda3 3907022848 3907029167 6320 3.1M c W95 FAT32 (LBA)
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: HGST HUS726020AL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x749eb73b
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 314574847 314572800 150G fd Linux raid autodetect
/dev/sdb2 314574848 315623423 1048576 512M 82 Linux swap / Solaris
/dev/sdb3 315623424 3907029167 3591405744 1.7T fd Linux raid autodetect
Disk /dev/md1: 1.8 TiB, 1999857713152 bytes, 3905972096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md0: 149.9 GiB, 160927055872 bytes, 314310656 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md2: 3.4 TiB, 3677330866176 bytes, 7182286848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Il faudrait avoir plus d'information :
Contenu de fstab :
/etc/fstab
Contenu de grub.cfg :
/etc/boot/grub.cfg
Résultats des commandes :
blkid
mount
mdadm --detail /dev/md0
mdadm --detail /dev/md1
mdadm --detail /dev/md2
Ces informations permettront d'expliquer pourquoi le système boote sur /dev/md1.
Bonjour,
Merci de t'intéresser à mon problème.
J'ai tenté d'insérer l'UUID de mon /dev/md0 dans /etc/defaut/grub avec
`GRUB_DEVICE=UUID=75501a7d-f201-414c-ae5c-510cb8500a0d`
et j'ai également modifié mon fstab pour que ce md0 soit monté à la racine mais ça ne fonctionne pas
Voici les détails demandés :
/home/debian# cat /etc/fstab
UUID="75501a7d-f201-414c-ae5c-510cb8500a0d" / ext4 defaults 0 0
UUID="6cc04f86-5124-4688-bab6-0c3e4b867d85" swap swap defaults 0 0
UUID="2d65e03e-9a7a-4225-9393-dac66d0caf35" swap swap defaults 0 0
UUID="dc2ba393-d1f4-4e45-bd4a-7aae156a157e" swap swap defaults 0 0
UUID="779df8b9-742a-4091-922f-15365aca661d" /home/data/ ext4 defaults 0 0
``
home/debian# cat /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="–id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/8becb5dc951696bfa4d2adc226fd5302'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='mduuid/8becb5dc951696bfa4d2adc226fd5302' 87a12930-0e82-4e7e-9f53-568b7738b852
else
search --no-floppy --fs-uuid --set=root 87a12930-0e82-4e7e-9f53-568b7738b852
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-UUID=87a12930-0e82-4e7e-9f53-568b7738b852' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/8becb5dc951696bfa4d2adc226fd5302'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='mduuid/8becb5dc951696bfa4d2adc226fd5302' 87a12930-0e82-4e7e-9f53-568b7738b852
else
search --no-floppy --fs-uuid --set=root 87a12930-0e82-4e7e-9f53-568b7738b852
fi
echo 'Loading Linux 4.19.0-12-amd64 …'
linux /boot/vmlinuz-4.19.0-12-amd64 root=UUID=87a12930-0e82-4e7e-9f53-568b7738b852 ro vga=normal modprobe.blacklist=btrfs
echo 'Loading initial ramdisk …'
initrd /boot/initrd.img-4.19.0-12-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-UUID=87a12930-0e82-4e7e-9f53-568b7738b852' {
menuentry 'Debian GNU/Linux, with Linux 4.19.0-12-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-12-amd64-advanced-UUID=87a12930-0e82-4e7e-9f53-568b7738b852' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/8becb5dc951696bfa4d2adc226fd5302'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='mduuid/8becb5dc951696bfa4d2adc226fd5302' 87a12930-0e82-4e7e-9f53-568b7738b852
else
search --no-floppy --fs-uuid --set=root 87a12930-0e82-4e7e-9f53-568b7738b852
fi
echo 'Loading Linux 4.19.0-12-amd64 …'
linux /boot/vmlinuz-4.19.0-12-amd64 root=UUID=87a12930-0e82-4e7e-9f53-568b7738b852 ro vga=normal modprobe.blacklist=btrfs
echo 'Loading initial ramdisk …'
initrd /boot/initrd.img-4.19.0-12-amd64
}
menuentry 'Debian GNU/Linux, with Linux 4.19.0-12-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-12-amd64-recovery-UUID=87a12930-0e82-4e7e-9f53-568b7738b852' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod diskfilter
insmod mdraid09
insmod ext2
set root='mduuid/8becb5dc951696bfa4d2adc226fd5302'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='mduuid/8becb5dc951696bfa4d2adc226fd5302' 87a12930-0e82-4e7e-9f53-568b7738b852
else
search --no-floppy --fs-uuid --set=root 87a12930-0e82-4e7e-9f53-568b7738b852
fi
echo 'Loading Linux 4.19.0-12-amd64 …'
linux /boot/vmlinuz-4.19.0-12-amd64 root=UUID=87a12930-0e82-4e7e-9f53-568b7738b852 ro single vga=normal
echo 'Loading initial ramdisk …'
initrd /boot/initrd.img-4.19.0-12-amd64
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
/home/debian# blkid
/dev/sdc1: UUID="c13c9a9f-2910-2bf7-946d-f5456ee34403" UUID_SUB="13e680a4-7457-83cc-7fc6-a5dfc5f55948" LABEL="rescue.ovh.net:0" TYPE="linux_raid_member" PARTUUID="a27a9a62-01"
/dev/sdc3: UUID="a700fe51-e096-9053-c072-a25addd710b2" UUID_SUB="5980de19-ed74-2158-0693-290e01eef356" LABEL="rescue.ovh.net:2" TYPE="linux_raid_member" PARTUUID="a27a9a62-03"
/dev/sda1: UUID="8becb5dc-9516-96bf-a4d2-adc226fd5302" TYPE="linux_raid_member" PARTUUID="4ca6006e-01"
/dev/sda2: LABEL="swap-sda2" UUID="6cc04f86-5124-4688-bab6-0c3e4b867d85" TYPE="swap" PARTUUID="4ca6006e-02"
/dev/sda3: UUID="2020-12-07-09-55-11-00" LABEL="config-2" TYPE="iso9660" PARTUUID="4ca6006e-03"
/dev/sdb1: UUID="c13c9a9f-2910-2bf7-946d-f5456ee34403" UUID_SUB="7dedb0e0-08d8-1844-56c0-0a2a0cd98faf" LABEL="rescue.ovh.net:0" TYPE="linux_raid_member" PARTUUID="749eb73b-01"
/dev/sdb3: UUID="a700fe51-e096-9053-c072-a25addd710b2" UUID_SUB="1938d0b2-ab67-cfb0-c300-5c2b8eae7176" LABEL="rescue.ovh.net:2" TYPE="linux_raid_member" PARTUUID="749eb73b-03"
/dev/md1: LABEL="/" UUID="87a12930-0e82-4e7e-9f53-568b7738b852" TYPE="ext4"
/dev/md0: UUID="75501a7d-f201-414c-ae5c-510cb8500a0d" TYPE="ext4"
/dev/md2: UUID="779df8b9-742a-4091-922f-15365aca661d" TYPE="ext4"
/dev/sdc2: PARTUUID="a27a9a62-02"
/dev/sdb2: PARTUUID="749eb73b-02"
/home/debian# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=16402348k,nr_inodes=4100587,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=3283908k,mode=755)
/dev/md1 on / type ext4 (rw,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1683)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,relatime)
/dev/md2 on /home/yunohost.transmission type ext4 (rw,relatime,stripe=256)
/dev/md0 on /mnt/md0 type ext4 (rw,relatime)
none on /mnt/md0/proc type proc (rw,relatime)
udev on /mnt/md0/dev type devtmpfs (rw,nosuid,relatime,size=16402348k,nr_inodes=4100587,mode=755)
none on /mnt/md0/sys type sysfs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=3283904k,mode=700,uid=1000,gid=1000)
``
/home/debian# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jun 3 12:00:11 2021
Raid Level : raid1
Array Size : 157155328 (149.88 GiB 160.93 GB)
Used Dev Size : 157155328 (149.88 GiB 160.93 GB)
Raid Devices : 3
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Fri Jun 11 23:47:54 2021
State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Consistency Policy : bitmap
Name : rescue.ovh.net:0
UUID : c13c9a9f:29102bf7:946df545:6ee34403
Events : 2880
Number Major Minor RaidDevice State
- 0 0 0 removed
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
root@mon-courrier:/home/debian# mdadm --detail /dev/md1
/dev/md1:
Version : 0.90
Creation Time : Mon Dec 7 09:54:54 2020
Raid Level : raid1
Array Size : 1952986048 (1862.51 GiB 1999.86 GB)
Used Dev Size : 1952986048 (1862.51 GiB 1999.86 GB)
Raid Devices : 3
Total Devices : 1
Preferred Minor : 1
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Jun 13 19:03:43 2021
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Consistency Policy : bitmap
UUID : 8becb5dc:951696bf:a4d2adc2:26fd5302
Events : 0.739678
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
- 0 0 1 removed
- 0 0 2 removed
root@mon-courrier:/home/debian# mdadm --detail /dev/md2
/dev/md2:
Version : 1.2
Creation Time : Thu Jun 3 13:28:06 2021
Raid Level : raid5
Array Size : 3591143424 (3424.78 GiB 3677.33 GB)
Used Dev Size : 1795571712 (1712.39 GiB 1838.67 GB)
Raid Devices : 3
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Jun 13 18:57:31 2021
State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : bitmap
Name : rescue.ovh.net:2
UUID : a700fe51:e0969053:c072a25a:ddd710b2
Events : 184218
Number Major Minor RaidDevice State
- 0 0 0 removed
1 8 19 1 active sync /dev/sdb3
2 8 35 2 active sync /dev/sdc3
Je n'ai jamais fait une telle manipulation donc pas de solution.
Il me semble cependant qu'après modification du fichier /etc/fstab,
il faudrait utiliser la commande "update-initramfs -u" pour mettre à jour le ramdisk associé au kernel.
Chronologie suivante à voir ? (attention pas de garantie)
chrooter nouveau raid
for i in /dev /dev/pts /proc /run /sys ; do mount --bind $i /mnt$i; done
modifier /etc/fstab
update-initramfs -u
gurb-install
grub-mkconfig
for i in /dev /dev/pts /proc /run /sys ; do unmount /mnt$i; done
quitter chroot (exit)
reboot
Super, cela a fonctionné!
Je te remercie vivement! Plus qu'à reconstruire mes raids, merci encore!