Raid 1 on mint 12

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
bsr203

Raid 1 on mint 12

Post by bsr203 »

Hello group,
There is an excellent post on how to setup raid 1 during new installation on Ubuntu here (software raid)
https://help.ubuntu.com/community/Insta ... ftwareRAID

I have been struggling y'day to do something similar in mint. 2 years back I could do similar approach in Debian, and cannot believe it that difficult in mint. So,I might be missing something. The way I tried to do was

1. There is no advanced partition (though I can manually create the number of partitions), which also helps to create RAID
2. I tried to create partition layout using GParted and then create Raid array using Disk Utility, that didn't work. I also had to install mdadm.
3. Tried the other way around, that too didn't work
4. Created partition using GParted, installed mdadm and manually created Raid arrays. It took an hour to sync. Some internet posts suggest to mount the new array and create configure file etc. I am not quite sure how that work as I currently work through live cd, and where the files are saved.

Please help me with brief pointers to steps I need to take, like the Ubuntu tutorial.

Thanks,
bsr.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Raid 1 on mint 12

Post by AlbertP »

That tutorial is very outdated. Here's a better one (though a bit outdated as well): http://www.howtoforge.com/install-ubunt ... re-raid-10

It's about Raid 10 and 4 disks. But it should work with Raid 1 and 2 disks as well. Make sure to replace all raid10 references in commands with raid1.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
jack_

Re: Raid 1 on mint 12

Post by jack_ »

bsr203 wrote:Hello group,
There is an excellent post on how to setup raid 1 during new installation on Ubuntu here (software raid)
https://help.ubuntu.com/community/Insta ... ftwareRAID

I have been struggling y'day to do something similar in mint. 2 years back I could do similar approach in Debian, and cannot believe it that difficult in mint. So,I might be missing something. The way I tried to do was

1. There is no advanced partition (though I can manually create the number of partitions), which also helps to create RAID
2. I tried to create partition layout using GParted and then create Raid array using Disk Utility, that didn't work. I also had to install mdadm.
3. Tried the other way around, that too didn't work
4. Created partition using GParted, installed mdadm and manually created Raid arrays. It took an hour to sync. Some internet posts suggest to mount the new array and create configure file etc. I am not quite sure how that work as I currently work through live cd, and where the files are saved.

Please help me with brief pointers to steps I need to take, like the Ubuntu tutorial.

Thanks,
bsr.
You've wanted yourself...
Let's assume that we have /dev/sda and /dev/sdb disks.

1. Run LiveCD LinuxMint12

2. Install mdadm through apt-get, aptitude, Software Manager etc.

3. Partitioning:
a) BIOS + hdd <2TB - use gparted, make label msdos
example:
/dev/sda1 -> your total size for root, boot, and home etc. [gparted automatically will align this] -> boot flag on
/dev/sda2 -> your best swap size
Don't format partitions !! The same for /dev/sdb !

b) BIOS + hdd >2TB, or UEFI[new motherboards] - gparted, make label GPT, first partition min. 1MiB with bios_grub flag !!
example:
/dev/sda1 -> 1MiB bios_grub flag on
/dev/sda2 -> your total size for root, boot, and home etc. -> boot flag on
/dev/sda3 -> your best swap size
Don't format partitions !! The same for /dev/sdb !

4. Create RAID1 - open Terminal

Code: Select all

sudo su
for 3a)

Code: Select all

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
for 3b)

Code: Select all

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3
Array's are creating - we can go forward.
If you wanna check this type:

Code: Select all

cat /proc/mdstat
4.5 Open Terminal:

Code: Select all

# sudo su
# mke2fs -t ext4 /dev/md0
# mkswap /dev/md1
5. Start LinuxMint12 installation from desktop
Choose hand partitioning and point to:
/dev/md0 / ext4
/dev/md1 swap
Let the install go till the end, and on last question choose to NOT reboot yet !!

6. Adjust new installation:
Start Terminal:

Code: Select all

sudo su
mount --bind /dev /target/dev
mount --bind /dev/pts /target/dev/pts
mount --bind /proc /target/proc
mount --bind /sys /target/sys
mount --bind /tmp /target/tmp
chroot /target
Install mdadm:

Code: Select all

apt-get install mdadm -> when it will ask you choose BOOT_DEGRADED=true !!!
cd /etc/mdadm
nano mdadm.conf -> delete / from array names so they should look like /dev/md0 and /dev/md1
Updating new settings

Code: Select all

update-initramfs -uv
update-grub
grub-install /dev/sda
grub-install /dev/sdb
Leaving chroot

Code: Select all

exit
umount /target/dev
umount /target/dev/pts
umount /target/proc
umount /target/sys
umount /target/tmp
If you did all correctly you should be happy owner of Linux Mint 12 on RAID1.

Chose:
Waiting for RAID to sync:

Code: Select all

watch -n1 cat /proc/mdstat
Reboot and array will be syncing on new installation:

Code: Select all

reboot
Best regards!
Last edited by jack_ on Thu Dec 22, 2011 5:14 pm, edited 1 time in total.
bsr203

Re: Raid 1 on mint 12

Post by bsr203 »

Jack,
I can't thank you enough for the effort to help me. Before I see your answer, I could make it to work with the link Albert pointed out. May be due to my mistake, there was an extra array created and tried to follow your procedure. I only have 500GB HDD , so I was following option a. I have two questions

1. When use gparted, the default file system is ext2, I changed it to ext4. I also set label as you suggested. Is this correct, or should I leave it ext2.
2. How do I perform step 5.
"Choose hand partitioning and point to:
/dev/md0 / ext4
/dev/md1 swap"

I choose, 'Something else" in the installation type
http://imageshack.us/photo/my-images/82 ... ontype.png

But, I cannot do anything on md0 or md1 as all the operations are disabled.
http://imageshack.us/photo/my-images/560/installu.png

In http://www.howtoforge.com/install-ubunt ... re-raid-10 tutorial , they created a link so that the installer recognizes it. Should I do it, or any other option available?

Thanks again for ur help,
bsr.
jack_

Re: Raid 1 on mint 12

Post by jack_ »

"3. Partitioning:
a) BIOS + hdd <2TB - use gparted, make label msdos
example:
/dev/sda1 -> your total size for root, boot, and home etc. [gparted automatically will align this] -> boot flag on
/dev/sda2 -> your best swap size
Don't format partitions !! The same for /dev/sdb !"

You didn't read carefully.
You should not format /dev/sda and /dev/sdb partitions. You should choose "unformated".
But even with that it should be ok. Strange thing is that you don't have any size for /dev/md0 or /dev/md1

Give me results from terminal:

Code: Select all

# sudo su
# parted
# select /dev/sda
# unit mib
# print

Code: Select all

# sudo su
# parted
# select /dev/sdb
# unit mib
# print

Code: Select all

# sudo su
# cat /proc/mdstat

Code: Select all

# sudo su
# mdadm --detail /dev/md0

Code: Select all

# sudo su
# mdadm --detail /dev/md1

Code: Select all

# sudo su
# blkid
I think that I will create a tutorial on howtoforge...
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: Raid 1 on mint 12

Post by AlbertP »

Turning on the boot flag is not needed, by the way. The boot flag is only used by Windows.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
bsr203

Re: Raid 1 on mint 12

Post by bsr203 »

Hello Jack,
Thanks for the quick reply.

"3. Partitioning:
You should not format /dev/sda and /dev/sdb partitions. You should choose "unformated".
I though I may choose the file system, but there was a flag to indicate whether should I format the disk. I left the flag unchecked. Thanks for making it clear now.

Please see the output you requested. I will try with re-partitioning with selecting 'unformated" as well.

Thanks again for your help,
bsr.

mint@mint ~ $ sudo su
mint mint # parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sda
Using /dev/sda
(parted) unit mib
(parted) print
Model: ATA WDC WD5000AAKS-0 (scsi)
Disk /dev/sda: 476940MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1.00MiB 466940MiB 466939MiB primary ext4 boot
2 466940MiB 476940MiB 10000MiB primary ext4

(parted) q
mint mint #

mint@mint ~ $ sudo su
mint mint # parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb
Using /dev/sdb
(parted) unit mib
(parted) print
Model: ATA WDC WD5000AAKS-0 (scsi)
Disk /dev/sdb: 476940MiB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1.00MiB 466940MiB 466939MiB primary ext4 boot
2 466940MiB 476940MiB 10000MiB primary ext4

(parted) q
mint mint #

mint mint # cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[0]
10238904 blocks super 1.2 [2/2] [UU]

md0 : active raid1 sdb1[1] sda1[0]
478144376 blocks super 1.2 [2/2] [UU]

unused devices: <none>
mint mint # mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Dec 21 03:23:39 2011
Raid Level : raid1
Array Size : 478144376 (455.99 GiB 489.62 GB)
Used Dev Size : 478144376 (455.99 GiB 489.62 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Wed Dec 21 12:21:17 2011
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Name : mint:0 (local to host mint)
UUID : 18969cb0:85e7e195:f9bc0d95:2af8aef2
Events : 19

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
mint mint # mdadm --detail /dev/md1
/dev/md1:
Version : 1.2
Creation Time : Wed Dec 21 03:23:56 2011
Raid Level : raid1
Array Size : 10238904 (9.76 GiB 10.48 GB)
Used Dev Size : 10238904 (9.76 GiB 10.48 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Wed Dec 21 12:21:17 2011
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Name : mint:1 (local to host mint)
UUID : 00bd9056:52cade03:0c7fa1b0:c5471710
Events : 19

Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
1 8 18 1 active sync /dev/sdb2
mint mint # blkid
/dev/sdb1: UUID="18969cb0-85e7-e195-f9bc-0d952af8aef2" UUID_SUB="e097154e-3e59-012a-5e08-703c2d75c462" LABEL="mint:0" TYPE="linux_raid_member"
/dev/sdb2: UUID="00bd9056-52ca-de03-0c7f-a1b0c5471710" UUID_SUB="8abac70b-2bf1-e13b-043d-876298624445" LABEL="mint:1" TYPE="linux_raid_member"
/dev/sda1: UUID="18969cb0-85e7-e195-f9bc-0d952af8aef2" UUID_SUB="06caf29a-c6a1-37ef-9ec4-4ce20d740c14" LABEL="mint:0" TYPE="linux_raid_member"
/dev/sda2: UUID="00bd9056-52ca-de03-0c7f-a1b0c5471710" UUID_SUB="ea511cef-8835-bad7-6700-d6c12e3c9f1d" LABEL="mint:1" TYPE="linux_raid_member"
/dev/loop0: TYPE="squashfs"
mint mint #
jack_

Re: Raid 1 on mint 12

Post by jack_ »

My fault !

There should be point 4.5 in my first post.
Don' change anything - besides that formatting it's all OK.
If you repartition disks you must recreate the array but let's try do end this in that way.
We must manually format the array - that should do the trick.
Please do:

4.5 Open Terminal:

Code: Select all

# sudo su
# mke2fs -t ext4 /dev/md0
# mkswap /dev/md1
After that try again to run the installer and start from point 5.
bsr203

Re: Raid 1 on mint 12

Post by bsr203 »

Hello jack,

The installation went through after following ur suggestion. But, it failed to install grub on sda1, sda, md0 etc. Please see the errors below.

http://imageshack.us/photo/my-images/35/gruberror.png/
http://imageshack.us/photo/my-images/80 ... rror2.png/
http://imageshack.us/photo/my-images/94/gruberror3.png/

The installer hung when I tried to cancel. Then, I open the terminal and continued from step 6. Everything went fine, and I could login after reboot.

now, to test the raid is working, I removed the power from first disk and booted the system. It worked fine, and show the message of degraded array.
I put the power back, and removed the power of second drive. This time too everything worked as usaual.
Now, I put both disk back and the system did not boot completely. It stopped with a prompt (initramfs)

I tried couple of commands to recreate the array, but I may be wrong
mdadm --assemble --scan
mdadm --add /dev/mdo /dev/sda1

both failed with error
mdadm: CREATE group disk not found


the output of cat /proc/mdstat

md1: active raid1 sdb2[1] sda2[0]
...super 1.2 [2/2] [UU]

md0: active raid1 sdb1[1]
...super 1.2 [2/1] [_U]

Please help,
bsr
md0: a
bsr203

Re: Raid 1 on mint 12

Post by bsr203 »

May be I was bit quick to ask for help. I see the arrays are re-creating now.

Still wonder what was the error"CREATE group disk not found" , and what is the right procedure.

thanks again for ur help.
bsr
jack_

Re: Raid 1 on mint 12

Post by jack_ »

The installation went through after following ur suggestion. But, it failed to install grub on sda1, sda, md0 etc. Please see the errors below.
You have on point 6 manual installation of grub - always to disk /dev/sda, /dev/sdb, not to partitions.

I didn't understand if all is working OK or not.
NEVER, EVER, EVER, E-V-E-R !!! disable 2 disk at once !!!!

If you disable 1 disk you have degraded array !!
You can take out second disk ONLY! after successful synchronization of an array, or you someday loose your data!
Because RAID1 is a mirror you've been lucky this time.
If you do this on RAID5 you will loose you data immediately.

Once again. We're taking out 1 disk, booting - all ok, put disk back, wait for sync, take out second, boot - all ok, put back second.
Never in a different way!

And last word... like everybody are saying - RAID IS NOT A BACKUP FEATURE. It not protects you from fire, water and user mistakes.
Only backup can do this[hidden few kilometers from home].
bsr203

Re: Raid 1 on mint 12

Post by bsr203 »

Jack,
Thanks again for your help. Learned a lot from you. I am enjoying mint now :-)
Best regards,
bsr.
s_a_l

Re: Raid 1 on mint 12

Post by s_a_l »

This was a great help, but it still took me 2 days to set up mirroring (RAID1) for Mint 14.
Essentially the Mint Installer is extremely flaky, and it's difficult to find the right
combination of "tricks" to achieve the desired installation. Here are a few of my notes:

a. The “boot flag” is not needed. Apparently it's only used by Windows
b. bios_grub partition is not needed
c. grub no longer needs a separate /boot partition (though some people say that
it is a good idea if you need to change to another distro)
d. Problems with Linux Mint installer:
i. Ensure each partition to mirror is prepared with gparted and then pre-formatted
before running the installer by using mke2fs –t ext4 /dev/md0 etc
ii. Installer fails if the swap space is mirrored. Therefore don’t mirror swap before
running the installer. Instead create a single swap partition
(I did this from within the Mint Installer rather than with gparted). This will lead
to difficulties after install – namely you will need to create mirrored swap once
installation is complete
iii. The installer will freeze with “Saving Packages” (or similar), unless you specifically
click on the “Format” checkbox for each partition before launching go
e. Installing grub will fail. When exiting the installer, it will probably hang. (It also means
that none of the cleanup was performed so there may be stray files around)
f. Before chroot, you must also copy the /etc/resolv.conf file to /target/etc/resolv.conf.
Otherwise once you’ve chrooted, you won’t be able to do apt-get update or install
mdadm (as it won’t find dns servers and cannot resolve internet addresses)
g. Whilst chrooted, now is probably the best place to set up the mirrored swap. Being pretty
unfamiliar myself, I struggled with various issues, but eventually did it by booting from
the USB key again, using fdisk to create the swap partitions and set up mirroring.
(Otherwise the system continuously gave "device busy")
h. If you change /etc/mdadm/mdadm.conf, always do an update-initramfs -uv afterwards
(Otherwise the mirroring won't come back after reboot, or else reboot invents new
names for your mirrors such as md127
i. To Test: Using the mdadm command, firstly fail, and then “remove” the disk to
simulate disk failure.
j. NB running gparted on a system with mirrors causes some sort of error message
when launched. This looks like a bug in the mint version of gparted, and is why
I resorted to fdisk for creating swap partitions
spellerm

Re: Raid 1 on mint 12

Post by spellerm »

jack_ wrote: You've wanted yourself...
Let's assume that we have /dev/sda and /dev/sdb disks.

1. Run LiveCD LinuxMint12
----------------------------------

Reboot and array will be syncing on new installation:

Code: Select all

reboot
Best regards!

Hello, group, I was trying to install Linux Mint with software raid as jack_ advised, till the step 5 all went good,

I used sda1 and sdb1 partitions for swap (/dev/md0) and sda2 and sdb2 partitions for root.

When almost was done at the end of installation it says me that

Code: Select all

	Executing 'grub-install /dev/sda' failed.
	This is a fatal error.
And then it tells me that Installer crashed, the report will be sent to bug tracker and so on...
And i closed that window, selected third hard disk (/dev/sdc) to install grub and went on by step 6


when updating new settings

on command grub-install /dev/sda
it says

Code: Select all

mdadm # grub-install /dev/sda
/usr/sbin/grub-bios-setup: warning: this LDM has no Embedding Partition; embedding won't be possible.
/usr/sbin/grub-bios-setup: error: embedding is not possible, but this is required for RAID and LVM install.

mdadm # grub-install /dev/sdb
Installation finished. No error reported.

Code: Select all

mint # umount /target/dev
umount: /target/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

mint # umount /target/proc
umount: /target/proc: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

But other mountpoints were unmounted correctly.

'lsof | grep target' shows that /target/dev is using by /dev/null

After reboot when i tried to boot from sda it said me Invalid Partion Table, just one line.

But during the installation i choosed sdc as the device on to which to install grub when i couldn't do that with sda
And when i choosed it (sdc) in BIOS it booted, but it means that if i'll switch off third hard it will not boot

Please point me what i must to do to unmount /target/dev and /target/proc, and what to do to install grub to sda??
Locked

Return to “Installation & Boot”