[Eisfair] Volle root-Partition E1 mit Software-Raid 5

Jürgen Witt j-witt at web.de
Sa Jan 3 21:09:05 CET 2015


Hallo Thomas,

Am 03.01.2015 um 09:31 schrieb Thomas Zweifel:
> Den Hinweis die bitmap zu entsorgen befolgen wir an der Stelle
>
> mdadm -G --bitmap=none /dev/md9
>
> und verkleinern das Raid
>
> service02test 2.3.6 # mdadm -G -z20G /dev/md9
> mdadm: component size of /dev/md9 has been set to 20971520K
>
> An der Stelle lassen sich auch M für MiB oder G für GiB nutzen, habe ich
> gerade herausgefunden. ;-)

Danke für Deine Informationen. Damit komme ich jetzt etwas weiter.

Beim Lesen Deiner Anleitung, schien mir oberflächlich halbwegs klar zu 
sein, was bei dem Ablauf passiert. Jetzt beim Probieren habe ich aber 
diverse Verständnisprobleme. So z.B. bei den zu wählenden Größen.

eis # mdadm -G --bitmap=none /dev/md4
eis # mdadm -G -z65G /dev/md4
mdadm: Cannot set device size for /dev/md4: No space left on device
eis # mdadm -G -z60G /dev/md4
mdadm: component size of /dev/md4 has been set to 62914560K

Das war jetzt trial and error, aber eigentlich will man ja um eine 
definierte Größe Änderungen vollziehen. Da es im Testsystem ein Raid-1 
aus zwei 80GB-Platte ist und ich 10GB für / definiert hatte, habe ich es 
mit einer Verkleinerung auf 65GB im ersten Versuch probiert. Das war 
aber zu viel.
Wie hätte ich das wissentschaftlicher" machen können? Bzw. wo vorher 
nachsehen oder was errechnen? Normaler Weise will man ja um eine 
definierte Größe (z.B. md4 soll um 10GB kleiner) reduzieren. Beim System 
des Kunden würde ich md4 auch nicht auf 500GB verkleinern wollen sondern 
um z.B. genau 10GB

OK, jetzt habe ich /dev/md4 also irgendwie stümperhaft verkleinert.

Jetzt aber weiter in Deiner Anleitung:

eis # e2fsck -f -C0 /dev/md4
e2fsck 1.42.12 (29-Aug-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/md4: 1340/802816 files (8.0% non-contiguous), 2667859/3200000 blocks

eis # resize2fs -p /dev/md4
resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/md4 to 15728640 (4k) blocks.
The filesystem on /dev/md4 is now 15728640 (4k) blocks long.

eis # for i in 1 2 3 4 ; do mdadm --fail /dev/md$i /dev/sdb$i ; mdadm 
--remove /dev/md$i /dev/sdb$i ; done
mdadm: set /dev/sdb1 faulty in /dev/md1
mdadm: hot removed /dev/sdb1 from /dev/md1
mdadm: set /dev/sdb2 faulty in /dev/md2
mdadm: hot removed /dev/sdb2 from /dev/md2
mdadm: set /dev/sdb3 faulty in /dev/md3
mdadm: hot removed /dev/sdb3 from /dev/md3
mdadm: set /dev/sdb4 faulty in /dev/md4
mdadm: hot removed /dev/sdb4 from /dev/md4

eis # for i in 3 4 ; do mdadm --zero-superblock /dev/sdb$i ; done


Ich habe meine sdb3 + sdb4 gelöscht und mit neuen Größen angelegt. Ich 
habe sdb3 nur moderat von 10 auf 12GB vergrößert. Die neue Größe von 
sdb4 ergibt sich ja automatisch (d.h. ich übernehme die Vorgaben von 
fdisk). Auch hier stellt sich mir die Frage mit den korrekten Größen. 
Die müssen sich ja aus etwas errechnen oder ergeben.

eis # fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.1).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): d
Partition number (1-4, default 4):
Partition 4 is deleted

Command (m for help): d
Partition number (1-3, default 3):
Partition 3 is deleted

Command (m for help): n
Partition type:
    p   primary (2 primary, 0 extended, 2 free)
    e   extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (112455-156301487, default 8419328):
Using default value 8419328
Last sector, +sectors or +size{K,M,G} (8419328-156301487, default 
156301487): +12288M
Partition 3 of type Linux and of size 12 GiB is set

Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'

Command (m for help): n
Partition type:
    p   primary (3 primary, 0 extended, 1 free)
    e   extended
Select (default e): p
Selected partition 4
First sector (112455-156301487, default 33585152):
Using default value 33585152
Last sector, +sectors or +size{K,M,G} (33585152-156301487, default 
156301487):
Using default value 156301487
Partition 4 of type Linux and of size 58.5 GiB is set

Command (m for help): t
Partition number (1-4, default 4):
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'

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

Calling ioctl() to re-read partition table.
Syncing disks.

eis # cat /proc/partitions
major minor  #blocks  name

    8        0   78150744 sda
    8        1      55203 sda1
    8        2    4152802 sda2
    8        3   10490443 sda3
    8        4   63448716 sda4
    8       32  244198584 sdc
    8       33      49152 sdc1
    8       34    1048576 sdc2
    8       35   20971520 sdc3
    8       36  222118055 sdc4
    8       16   78150744 sdb
    8       17      55203 sdb1
    8       18    4152802 sdb2
    8       19   12582912 sdb3
    8       20   61358168 sdb4
    9        1      55104 md1
    9        2    4150720 md2
    9        3   10482176 md3
    9        4   59904000 md4
    3       64    4194302 hdb

Mein Raid-1-Testsystem besteht aus sda und sdb. Ich habe mit den 
Größenänderungen mit sdb angefangen.

Das hier sieht aber für mich nicht OK aus:

eis # sfdisk -luM

Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1   *     1     54-    54-     55203+  fd  Linux raid autodetect
/dev/sda2        54+  4110-  4056-   4152802   fd  Linux raid autodetect
/dev/sda3      4110+ 14354- 10245-  10490443   fd  Linux raid autodetect
/dev/sda4     14354+ 76316- 61962-  63448716+  fd  Linux raid autodetect

Disk /dev/sdc: 30401 cylinders, 255 heads, 63 sectors/track
sfdisk: Warning: The partition table looks like it was made
   for C/H/S=*/256/63 (instead of 30401/255/63).
For this listing I'll assume that geometry.

Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdc1         0+ 238475- 238476- 244198583+  ee  GPT
/dev/sdc2         0      -      0          0    0  Empty
/dev/sdc3         0      -      0          0    0  Empty
/dev/sdc4         0      -      0          0    0  Empty

Disk /dev/sdb: 9729 cylinders, 255 heads, 63 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdb1   *     1     54-    54-     55203+  fd  Linux raid autodetect
/dev/sdb2        54+  4110-  4056-   4152802   fd  Linux raid autodetect
/dev/sdb3      4111  16398  12288   12582912   fd  Linux raid autodetect
sfdisk:                 end: (c,h,s) expected (1023,254,63) found 
(42,147,41)

/dev/sdb4     16399  76319- 59921-  61358168   fd  Linux raid autodetect
sfdisk:                 start: (c,h,s) expected (1023,254,63) found 
(42,147,42)

sfdisk:                 end: (c,h,s) expected (1023,254,63) found 
(513,80,63)


Disk /dev/md1: 13776 cylinders, 2 heads, 4 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/md1p1         0      -      0          0    0  Empty
/dev/md1p2         0      -      0          0    0  Empty
/dev/md1p3         0      -      0          0    0  Empty
/dev/md1p4         0      -      0          0    0  Empty

Disk /dev/md2: 1037680 cylinders, 2 heads, 4 sectors/track

Disk /dev/md3: 2620544 cylinders, 2 heads, 4 sectors/track

Disk /dev/md4: 14976000 cylinders, 2 heads, 4 sectors/track


Vor den Änderungen sah es so aus:

eis # sfdisk -luM

Disk /dev/sdb: 9729 cylinders, 255 heads, 63 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdb1   *     1     54-    54-     55203+  fd  Linux raid autodetect
/dev/sdb2        54+  4110-  4056-   4152802   fd  Linux raid autodetect
/dev/sdb3      4110+ 14354- 10245-  10490443   fd  Linux raid autodetect
/dev/sdb4     14354+ 76316- 61962-  63448716+  fd  Linux raid autodetect

Disk /dev/sdc: 30401 cylinders, 255 heads, 63 sectors/track
sfdisk: Warning: The partition table looks like it was made
   for C/H/S=*/256/63 (instead of 30401/255/63).
For this listing I'll assume that geometry.

Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdc1         0+ 238475- 238476- 244198583+  ee  GPT
/dev/sdc2         0      -      0          0    0  Empty
/dev/sdc3         0      -      0          0    0  Empty
/dev/sdc4         0      -      0          0    0  Empty

Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1   *     1     54-    54-     55203+  fd  Linux raid autodetect
/dev/sda2        54+  4110-  4056-   4152802   fd  Linux raid autodetect
/dev/sda3      4110+ 14354- 10245-  10490443   fd  Linux raid autodetect
/dev/sda4     14354+ 76316- 61962-  63448716+  fd  Linux raid autodetect

Disk /dev/md1: 13776 cylinders, 2 heads, 4 sectors/track
Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start   End    MiB    #blocks   Id  System
/dev/md1p1         0      -      0          0    0  Empty
/dev/md1p2         0      -      0          0    0  Empty
/dev/md1p3         0      -      0          0    0  Empty
/dev/md1p4         0      -      0          0    0  Empty

Disk /dev/md2: 1037680 cylinders, 2 heads, 4 sectors/track

Disk /dev/md3: 2620544 cylinders, 2 heads, 4 sectors/track

Disk /dev/md4: 15728640 cylinders, 2 heads, 4 sectors/track

Ich habe trotzdem einfach 'mal weiter gemacht:

for i in 1 2 3 4 ; do mdadm --add /dev/md$i /dev/sdb$i ; done

Nach einer Weile:

eis # cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] 
[raid4] [multipath]
md4 : active raid1 sdb4[2] sda4[1]
       59904000 blocks super 1.2 [2/2] [UU]

md3 : active raid1 sdb3[2] sda3[1]
       10482176 blocks super 1.2 [2/2] [UU]
       bitmap: 0/1 pages [0KB], 65536KB chunk

md2 : active raid1 sdb2[2] sda2[1]
       4150720 blocks super 1.2 [2/2] [UU]
       bitmap: 0/1 pages [0KB], 65536KB chunk

md1 : active raid1 sdb1[0] sda1[1]
       55104 blocks [2/2] [UU]
       bitmap: 0/1 pages [0KB], 65536KB chunk

unused devices: <none>

Da ich glaube, daß ich hier einigen Mist gebaut habe (bzw. nicht alles 
verstanden habe), habe ich an dieser Stelle erst 'mal wieder abgebrochen 
und hoffe auf neuen Input. Das Thema ist viel komplexer, als ich dachte.

Danke
Jürgen



Mehr Informationen über die Mailingliste Eisfair