# Sofware raid partitions, how to reset root pass?

## d0lph1n

Hello, 

Please help me reset the root password (I already tried all the grub kernel options).

existing software raid partitions: 

md0 - /boot 

md1 - / 

How to mount these partitions and reset the root pass after booting from a livecd? 

After booting from live cd, I can mount only sda & sdb partitions. 

I appreciate it. Thank youLast edited by d0lph1n on Thu Jun 09, 2011 8:47 pm; edited 1 time in total

----------

## NeddySeagoon

d0lph1n,

Do you have any /dev/md* nodes ?

If not you must manually assemble the raid with the 

```
mdadm -A ...
```

command.

What you put in place of the ... depends on how your raid was created. If you can't remember, run 

```
mdadm -E /dev/sda1
```

to see which raid /dev/sda1 is a part of. Repeat for the other partitions that belong to your raid sets.

Post all the outputs of mdadm -E  if you need exact commands to assemble your raid sets

----------

## d0lph1n

I hope this is what you are asking for:

ARRAY /dev/md0 level=raid1 num-devices=2 UUID=c3bf1794:438b1097:4810f325:cf9eeb11

ARRAY /dev/md1 level=raid1 num-devices=2 UUID=a4d46886:d9fc3256:51e125f6:c5c5ca84

----------

## NeddySeagoon

d0lph1n,

Not quite.  I'm looking for this 

```
$ sudo mdadm -E /dev/sda1

Password: 

/dev/sda1:

          Magic : a92b4efc

        Version : 0.90.00

           UUID : 9392926d:64086e7a:86638283:4138a597

  Creation Time : Sat Apr 11 16:34:40 2009

     Raid Level : raid1

  Used Dev Size : 40064 (39.13 MiB 41.03 MB)

     Array Size : 40064 (39.13 MiB 41.03 MB)

   Raid Devices : 4

  Total Devices : 4

Preferred Minor : 1

    Update Time : Sat Jun  4 15:34:59 2011

          State : clean

 Active Devices : 4

Working Devices : 4

 Failed Devices : 0

  Spare Devices : 0

       Checksum : 2e10cf - correct

         Events : 4

      Number   Major   Minor   RaidDevice State

this     0       8        1        0      active sync   /dev/sda1

   0     0       8        1        0      active sync   /dev/sda1

   1     1       8       17        1      active sync   /dev/sdb1

   2     2       8       33        2      active sync   /dev/sdc1

   3     3       8       49        3      active sync   /dev/sdd1
```

from each of the partitions that form your raid sets.

The key information here is 

```
Preferred Minor : 1
```

and the list of devices 

```
   0     0       8        1        0      active sync   /dev/sda1

   1     1       8       17        1      active sync   /dev/sdb1

   2     2       8       33        2      active sync   /dev/sdc1

   3     3       8       49        3      active sync   /dev/sdd1
```

Preferred Minor:1 shows that this is a member of /dev/md1 (notice the 1)

and its composed of the devices listed.

```
mdadm -A /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
```

will assemble the above array and udev should make /dev/md1 for you.

----------

## d0lph1n

mdadm -E /dev/sda1

/dev/sda1:

          Magic : a92b4efc

        Version : 00.90.00

           UUID : c3bf1794:438b1097:4810f325:cf9eeb11

  Creation Time : Mon Oct  5 18:09:00 2009

     Raid Level : raid1

    Device Size : 104320 (101.89 MiB 106.82 MB)

     Array Size : 104320 (101.89 MiB 106.82 MB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 0

    Update Time : Thu Jun  9 20:02:11 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

       Checksum : 60e24ae2 - correct

         Events : 0.48

      Number   Major   Minor   RaidDevice State

this     0       8        1        0      active sync   /dev/sda1

   0     0       8        1        0      active sync   /dev/sda1

   1     1       8       17        1      active sync   /dev/sdb1

=======

mdadm -E /dev/sdb1

/dev/sdb1:

          Magic : a92b4efc

        Version : 00.90.00

           UUID : c3bf1794:438b1097:4810f325:cf9eeb11

  Creation Time : Mon Oct  5 18:09:00 2009

     Raid Level : raid1

    Device Size : 104320 (101.89 MiB 106.82 MB)

     Array Size : 104320 (101.89 MiB 106.82 MB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 0

    Update Time : Thu Jun  9 20:02:11 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

       Checksum : 60e24af4 - correct

         Events : 0.48

      Number   Major   Minor   RaidDevice State

this     1       8       17        1      active sync   /dev/sdb1

   0     0       8        1        0      active sync   /dev/sda1

   1     1       8       17        1      active sync   /dev/sdb1

====

mdadm: No md superblock detected on /dev/sda2.

livecd ~ # mdadm -E /dev/sda3

/dev/sda3:

          Magic : a92b4efc

        Version : 00.90.00

           UUID : a4d46886:d9fc3256:51e125f6:c5c5ca84

  Creation Time : Mon Oct  5 18:09:29 2009

     Raid Level : raid1

    Device Size : 139452160 (132.99 GiB 142.80 GB)

     Array Size : 139452160 (132.99 GiB 142.80 GB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 1

    Update Time : Thu Jun  9 20:24:40 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

       Checksum : e0ae25ac - correct

         Events : 0.1190

      Number   Major   Minor   RaidDevice State

this     0       8        3        0      active sync   /dev/sda3

   0     0       8        3        0      active sync   /dev/sda3

   1     1       8       19        1      active sync   /dev/sdb3

===

livecd ~ # mdadm -E /dev/sdb3

/dev/sdb3:

          Magic : a92b4efc

        Version : 00.90.00

           UUID : a4d46886:d9fc3256:51e125f6:c5c5ca84

  Creation Time : Mon Oct  5 18:09:29 2009

     Raid Level : raid1

    Device Size : 139452160 (132.99 GiB 142.80 GB)

     Array Size : 139452160 (132.99 GiB 142.80 GB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 1

    Update Time : Thu Jun  9 20:24:40 2011

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

       Checksum : e0ae25be - correct

         Events : 0.1190

      Number   Major   Minor   RaidDevice State

this     1       8       19        1      active sync   /dev/sdb3

   0     0       8        3        0      active sync   /dev/sda3

   1     1       8       19        1      active sync   /dev/sdb3

----------

## NeddySeagoon

d0lph1n,

```
mdadm -A /dev/md0 /dev/sda1 /dev/sdb1
```

will assemble your raid.

--- edit ---

and 

```
mdadm -A /dev/md1 /dev/sda3 /dev/sdb3
```

will assemble the other raid set

----------

## d0lph1n

NeddySeagoon, this is what I get:

livecd ~ # mdadm -A /dev/md0 /dev/sda1 /dev/sdb1

mdadm: error opening /dev/md0: No such file or directory

livecd ~ # mdadm -A /dev/md1 /dev/sda3 /dev/sdb3

mdadm: error opening /dev/md1: No such file or directory

----------

## NeddySeagoon

d0lph1n,

You need mknod to create the  /dev nodes before the raid sets will assemble.

```

mknod --mode=660 /dev/md0 b 9 0

mknod --mode=660 /dev/md1 b 9 1
```

----------

## d0lph1n

NeddySeagoon,

Thank you. It worked. What's the next step?

livecd ~ # mdadm -A /dev/md0 /dev/sda1 /dev/sdb1

mdadm: /dev/md0 has been started with 2 drives.

livecd ~ # mdadm -A /dev/md1 /dev/sda3 /dev/sdb3

mdadm: /dev/md1 has been started with 2 drives.

===

I did the followings:

livecd ~ # mount /dev/md1 /mnt/gentoo

livecd ~ # mount /dev/md0 /mnt/gentoo.boot

mount: mount point /mnt/gentoo.boot does not exist

livecd ~ # mount /dev/md0 /mnt/gentoo/boot

livecd ~ # mount -t proc none /mnt/gentoo/proc

livecd ~ # mount -o bind /dev /mnt/gentoo/dev

livecd ~ # chroot /mnt/gentoo /bin/bash 

livecd / # env-update 

open('/etc/profile.env', 'r'): (5, 'Input/output error')

Traceback (most recent call last):

  File "/usr/sbin/env-update", line 36, in <module>

    portage.env_update(makelinks)

  File "/usr/lib/portage/pym/portage/__init__.py", line 971, in env_update

    target_root = settings["ROOT"]

  File "/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 38, in __getitem__

    return object.__getattribute__(self, '_get_target')()[key]

  File "/usr/lib/portage/pym/portage/__init__.py", line 9224, in _get_target

    init_legacy_globals()

  File "/usr/lib/portage/pym/portage/__init__.py", line 9309, in init_legacy_globals

    db = create_trees(**kwargs)

  File "/usr/lib/portage/pym/portage/__init__.py", line 9186, in create_trees

    config_incrementals=portage.const.INCREMENTALS)

  File "/usr/lib/portage/pym/portage/__init__.py", line 1871, in __init__

    expand=expand_map)

  File "/usr/lib/portage/pym/portage/util.py", line 414, in getconfig

    encoding=_encodings['fs'], errors='strict'), 'rb').read()

IOError: [Errno 5] Input/output error: '/etc/profile.env'

----------

## NeddySeagoon

d0lph1n,

Get into your chroot.

I guess md1 is your root and md0 is your /boot

```
mount /dev/md1 /mnt/gentoo

mount /dev/md0 /mnt/gentoo/boot

mount -t proc proc /mnt/gentoo/proc

mount -o bind /dev/mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash

env-update

source /etc/profile

passwd
```

I typed that from memory - you may find a few typos.  Its exactly what you did to get into the chroot when you installed.

Incidently, why is your swap not on a raid?

----------

## d0lph1n

According to the fstab image I have, the swap is not raid (no idea why, the adm's decission).

I chrooted and got the following errors:

mdadm: /dev/md1 has been started with 2 drives.

livecd ~ # mount /dev/md1 /mnt/gentoo

livecd ~ # mount /dev/md0 /mnt/gentoo.boot

mount: mount point /mnt/gentoo.boot does not exist

livecd ~ # mount /dev/md0 /mnt/gentoo/boot

livecd ~ # mount -t proc none /mnt/gentoo/proc

livecd ~ # mount -o bind /dev /mnt/gentoo/dev

livecd ~ # chroot /mnt/gentoo /bin/bash 

livecd / # env-update 

open('/etc/profile.env', 'r'): (5, 'Input/output error')

Traceback (most recent call last):

  File "/usr/sbin/env-update", line 36, in <module>

    portage.env_update(makelinks)

  File "/usr/lib/portage/pym/portage/__init__.py", line 971, in env_update

    target_root = settings["ROOT"]

  File "/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 38, in __getitem__

    return object.__getattribute__(self, '_get_target')()[key]

  File "/usr/lib/portage/pym/portage/__init__.py", line 9224, in _get_target

    init_legacy_globals()

  File "/usr/lib/portage/pym/portage/__init__.py", line 9309, in init_legacy_globals

    db = create_trees(**kwargs)

  File "/usr/lib/portage/pym/portage/__init__.py", line 9186, in create_trees

    config_incrementals=portage.const.INCREMENTALS)

  File "/usr/lib/portage/pym/portage/__init__.py", line 1871, in __init__

    expand=expand_map)

  File "/usr/lib/portage/pym/portage/util.py", line 414, in getconfig

    encoding=_encodings['fs'], errors='strict'), 'rb').read()

IOError: [Errno 5] Input/output error: '/etc/profile.env'

===

It looks like corrupted files. Could you tell me pls the correct/complete fcsk command (md1 should be ext3, md0 ext2). Thank you

----------

## d0lph1n

According to the fstab image I have, the swap is not raid (no idea why, the adm's decision).

I chrooted and got the following errors:

mdadm: /dev/md1 has been started with 2 drives.

livecd ~ # mount /dev/md1 /mnt/gentoo

livecd ~ # mount /dev/md0 /mnt/gentoo.boot

mount: mount point /mnt/gentoo.boot does not exist

livecd ~ # mount /dev/md0 /mnt/gentoo/boot

livecd ~ # mount -t proc none /mnt/gentoo/proc

livecd ~ # mount -o bind /dev /mnt/gentoo/dev

livecd ~ # chroot /mnt/gentoo /bin/bash 

livecd / # env-update 

open('/etc/profile.env', 'r'): (5, 'Input/output error')

Traceback (most recent call last):

  File "/usr/sbin/env-update", line 36, in <module>

    portage.env_update(makelinks)

  File "/usr/lib/portage/pym/portage/__init__.py", line 971, in env_update

    target_root = settings["ROOT"]

  File "/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 38, in __getitem__

    return object.__getattribute__(self, '_get_target')()[key]

  File "/usr/lib/portage/pym/portage/__init__.py", line 9224, in _get_target

    init_legacy_globals()

  File "/usr/lib/portage/pym/portage/__init__.py", line 9309, in init_legacy_globals

    db = create_trees(**kwargs)

  File "/usr/lib/portage/pym/portage/__init__.py", line 9186, in create_trees

    config_incrementals=portage.const.INCREMENTALS)

  File "/usr/lib/portage/pym/portage/__init__.py", line 1871, in __init__

    expand=expand_map)

  File "/usr/lib/portage/pym/portage/util.py", line 414, in getconfig

    encoding=_encodings['fs'], errors='strict'), 'rb').read()

IOError: [Errno 5] Input/output error: '/etc/profile.env'

===

It looks like corrupted files. Could you tell me pls the correct/complete fcsk command (md1 should be ext3, md0 ext2). Thank you

== 

ivecd / # e2fsck -f /dev/md1

e2fsck 1.41.9 (22-Aug-2009)

/dev/md1: recovering journal

Pass 1: Checking inodes, blocks, and sizes

Inode 9633803, i_size is 0, should be 12288.  Fix<y>? yes

Running additional passes to resolve blocks claimed by more than one inode...

Pass 1B: Rescanning for multiply-claimed blocks

Multiply-claimed block(s) in inode 6127617: 12326606 12326607

Multiply-claimed block(s) in inode 17235992: 12326606 12326607

Pass 1C: Scanning directories for inodes with multiply-claimed blocks

Pass 1D: Reconciling multiply-claimed blocks

(There are 2 inodes containing multiply-claimed blocks.)

File /var/log/messages (inode #6127617, mod time Thu Jun  9 13:24:37 2011) 

  has 2 multiply-claimed block(s), shared with 1 file(s):

	/root/.viminfo (inode #17235992, mod time Wed Jun  8 18:55:24 2011)

Clone multiply-claimed blocks<y>? yes

File /root/.viminfo (inode #17235992, mod time Wed Jun  8 18:55:24 2011) 

  has 2 multiply-claimed block(s), shared with 1 file(s):

	/var/log/messages (inode #6127617, mod time Thu Jun  9 13:24:37 2011)

Multiply-claimed blocks already reassigned or cloned.

Pass 2: Checking directory structure

Entry 'profile.env' in /etc (12632065) has deleted/unused inode 12632141.  Clear<y>?

Help please? What should I say? Yes?

----------

## NeddySeagoon

d0lph1n,

fsck is a very dangerous tool.  It can make things worse, not beter, so its a last resort.

Lets investigate a little first.  

Does /etc/profile.env  exist?

Are you able to post your 

```
emerge --info
```

?

If you really want to run fsck, its

```
e2fsck -p /dev/md1
```

 thats safe if /dev/md1 is not mounted.

If you feel lucky, change the -p to -y but be prepared to reinstall if you use that. Read 

```
man e2fsck
```

----------

## d0lph1n

is everything lost?

livecd / # e2fsck -f /dev/md1

e2fsck 1.41.9 (22-Aug-2009)

/dev/md1: recovering journal

Pass 1: Checking inodes, blocks, and sizes

Inode 9633803, i_size is 0, should be 12288.  Fix<y>? yes

Running additional passes to resolve blocks claimed by more than one inode...

Pass 1B: Rescanning for multiply-claimed blocks

Multiply-claimed block(s) in inode 6127617: 12326606 12326607

Multiply-claimed block(s) in inode 17235992: 12326606 12326607

Pass 1C: Scanning directories for inodes with multiply-claimed blocks

Pass 1D: Reconciling multiply-claimed blocks

(There are 2 inodes containing multiply-claimed blocks.)

File /var/log/messages (inode #6127617, mod time Thu Jun  9 13:24:37 2011) 

  has 2 multiply-claimed block(s), shared with 1 file(s):

	/root/.viminfo (inode #17235992, mod time Wed Jun  8 18:55:24 2011)

Clone multiply-claimed blocks<y>? yes

File /root/.viminfo (inode #17235992, mod time Wed Jun  8 18:55:24 2011) 

  has 2 multiply-claimed block(s), shared with 1 file(s):

	/var/log/messages (inode #6127617, mod time Thu Jun  9 13:24:37 2011)

Multiply-claimed blocks already reassigned or cloned.

Pass 2: Checking directory structure

Entry 'profile.env' in /etc (12632065) has deleted/unused inode 12632141.  Clear<y>? yes

Entry 'aux-cache' in /var/cache/ldconfig (14207884) has deleted/unused inode 1605633.  Clear<y>? yes

Pass 3: Checking directory connectivity

Pass 4: Checking reference counts

Inode 12632068 ref count is 1, should be 2.  Fix<y>? yes

Unattached inode 12632177

Connect to /lost+found<y>? yes

Inode 12632177 ref count is 2, should be 1.  Fix<y>? yes

Pass 5: Checking group summary information

Block bitmap differences:  -(19504497--19504499) +(19504525--19504527) -(25270977--25270981) -25272321 +25272340 -25276802 -25278468 -25280528 -25288706 -28421324 -28426996

Fix<y>? yes

Free blocks count wrong for group #4 (3, counted=1).

Fix<y>? yes

Free blocks count wrong for group #98 (1, counted=3).

Fix<y>? yes

Free blocks count wrong for group #376 (13169, counted=13171).

Fix<y>? yes

Free blocks count wrong for group #771 (10268, counted=10277).

Fix<y>? yes

Free blocks count wrong for group #867 (2, counted=4).

Fix<y>? yes

Free blocks count wrong (1971090, counted=1971103).

Fix<y>? yes

Inode bitmap differences:  -2589507 -12632139 -12632147 -12632162 -12632179 -12632182 -14204935

Fix<y>? yes

Free inodes count wrong for group #98 (16383, counted=16384).

Fix<y>? yes

Free inodes count wrong for group #771 (15855, counted=15860).

Fix<y>? yes

Free inodes count wrong for group #867 (2, counted=3).

Fix<y>? yes

Free inodes count wrong (15096082, counted=15096089).

Fix<y>? yes

/dev/md1: ***** FILE SYSTEM WAS MODIFIED *****

/dev/md1: ***** REBOOT LINUX *****

/dev/md1: 2336487/17432576 files (0.8% non-contiguous), 32891937/34863040 blocks

livecd / # 

livecd / # vi /ect/fstab

E575: viminfo: Illegal starting char in line: otal_opens_2jun.txt

E575: viminfo: Illegal starting char in line: ^I"^I1^I0

E576: viminfo: Missing '>' in line: 

E576: viminfo: Missing '>' in line: 

E576: viminfo: Missing '>' in line: 

E576: viminfo: Missing '>' in line: 

E576: viminfo: Missing '>' in line: 

E576: viminfo: Missing '>' in line: Jun  9 11:23:33 arm-dba kernel: pci 0000:08:00.0: PME# disabled

E576: viminfo: Missing '>' in line: Jun  9 11:23:33 arm-dba kernel: pci 0000:08:00.2: PXH quirk detected; SHPC device MSI disabled

E576: viminfo: Missing '>' in line: Jun  9 11:23:33 arm-dba kernel: pci 0000:08:00.2: PME# supported from D0 D3hot D3cold

E136: viminfo: Too many errors, skipping rest of file

Press ENTER or type command to continue

livecd / # e2fsck -p /dev/md1

/dev/md1: clean, 2336487/17432576 files, 32891937/34863040 blocks

livecd / # reboot

----------

## NeddySeagoon

d0lph1n,

Well, your /etc/fstab is gone.

Multiply-claimed block(s) are always a bad thing. One block can hold data belonging to at most, a single file.

Look at files with Multiply-claimed block(s) and throw them away.  You have no idea which file is correct, if any.

```
File /var/log/messages (inode #6127617, mod time Thu Jun 9 13:24:37 2011)

has 2 multiply-claimed block(s), shared with 1 file(s):

/root/.viminfo (inode #17235992, mod time Wed Jun 8 18:55:24 2011)
```

are not essential

```
Unattached inode 12632177

Connect to /lost+found<y>? yes 
```

what do you have in lost+found?  

Is that a directory a file or a file fragmant?

Understand that fsck makes the filesystem metadata self consistent. Self consistent does not mean correct.

It does nothing at all for user data on the filesystem. There is no way that can be checked

If your system contains no user data, I would advise you to reinstall.  If you have data, backup your data if you haven't already, then reinstall.

----------

## d0lph1n

Well. Everything seems to be ok.

1. I've created the ftsab manually.

2. force fsck check after reboot: touch /forcefsck

3. env-update && source /etc/profile  (fixed the mysql error)

4. Delete the .viminfo (fixed the vi error)

Thank you very much for your support. I appreciate it.

----------

