Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding RAID handling using mdadm #347

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions articles/raid.asm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
</resources>
<!-- Tasks -->
<resources>
<resource xml:id="_raid-creating-raids" href="../tasks/raid-creating-raids.xml">
<description>Creating RAIDs</description>
</resource>
<resource xml:id="_raid-naming-raid" href="../tasks/raid-naming-raid.xml">
<description>Naming RAIDs</description>
</resource>
Expand Down Expand Up @@ -308,9 +311,15 @@
<!-- pull in a topic and switch the title -->
<module resourceref="_raid-about-raids" renderas="section"/>
<module resourceref="_raid-raid-levels" renderas="section"/>
<!-- Rewrite the section for mdadm
<module resourceref="_raid-configuring-using-yast" renderas="section"/>
-->

<module resourceref="_raid-creating-raids" renderas="section">
<merge>
<abstract>
<para/>
</abstract>
</merge>
</module>

<module resourceref="_raid-management" renderas="section">
<module resourceref="_raid-naming-raid" renderas="section"/>
<module resourceref="_raid-configuring-stripe-size" renderas="section"/>
Expand Down
186 changes: 186 additions & 0 deletions tasks/raid-creating-raids.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file originates from the project https://github.com/openSUSE/doc-kit -->
<!-- This file can be edited downstream. -->
<!DOCTYPE topic
[
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
%entities;
]>
<!-- refers to legacy doc: <add github link to legacy doc piece, if applicable> -->
<!-- point back to this document with a similar comment added to your legacy doc piece -->
<!-- refer to README.md for file and id naming conventions -->
<!-- metadata is dealt with on the assembly level -->
<topic xml:id="raids-creating-raids"
role="task" xml:lang="en"
xmlns="http://docbook.org/ns/docbook" version="5.2"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:trans="http://docbook.org/ns/transclusion">
<info>
<title>Creating RAIDs using <command>mdadm</command></title><!-- can be changed via merge
in the assembly -->
<!-- add author's e-mail -->
<meta name="maintainer" content="[email protected]" its:translate="no"/>
<abstract><!-- can be changed via merge in the assembly -->
<para>
The <command>mdadm</command> enables you to manage RAID devices using CLI.
</para>
</abstract>
</info>
<para>
<command>mdadm</command> is a CLI tool that enables you to create, edit or remove RAID devices.
</para>
<note>
<title>Other possibilities to create RAIDs</title>
<para>
You can also use &cockpit; to create RAID devices or you can define them in the first boot
configuration that is applied during the deployment.
</para>
</note>
<para>
To create a RAID device, proceed as described further. In the example, the RAID level 5 will be created.
</para>
<procedure>
<step>
<para>
Before you start creating the RAID, ensure you have enough devices for the RAID type you want
to create. Check the available disk by running the command:
</para>
<screen>
&prompt.root;lsblk
</screen>
</step>
<step>
<para>
Create partitions on the disks and set the type to <literal>raid</literal> using the
<command>fdisk</command> command:
</para>
<screen>fdisk <replaceable>DEVICE</replaceable>
</screen>
<substeps>
<step>
<para>
Enter <keycap>n</keycap> to create a new partition.
</para>
</step>
<step>
<para>
Enter <keycap>p</keycap> to create a primary partition.
</para>
</step>
<step>
<para>
Choose a partition number by entering <keycap>1</keycap>.
</para>
</step>
<step>
<para>
Define the size by specifying sectors. You can keep the defaults by pressing <keycap>Enter</keycap> twice.
</para>
</step>
<step>
<para>
Enter <keycap>l</keycap> to list available partition types.
</para>
</step>
<step>
<para>
Enter <keycap>t</keycap> to select the partition type and type <literal>raid</literal>.
</para>
</step>
<step>
<para>
Verify the changes by entering <keycap>p</keycap>.
</para>
</step>
<step>
<para>
Write the cnfiguration by entering <keycap>w</keycap>.
</para>
</step>
<step>
<para>
Run the <command>fdisk</command> command on all devices that will form the RAID.
</para>
</step>
</substeps>
</step>
<step>
<para>
Create the RAID using the <command>mdadm</command> command:
</para>
<screen>&prompt.sudo;<command>mdadm</command> --create
<replaceable>RAID_DEVICE_NAME</replaceable> <replaceable>DEVICES</replaceable>
--level=<replaceable>RAID_TYPE</replaceable>
--raid-devices=<replaceable>DEVICES_COUNT</replaceable></screen>
<para>
For example:
</para>
<screen>&prompt.sudo;mdadm /dev/md1 /dev/sdb /dev/sdc /dev/sdd --level=5 --raid-devices=3</screen>
</step>
<step>
<para>
Create a file system on the RAID device. For example:
</para>
<screen>&prompt.sudo;mkfs.ext4 /dev/md1</screen>
</step>
<step os="sles">
<para>
Create a directory where the RAID should be mounted to. For example:
</para>
<screen>mkdir /mnt/raid5</screen>
</step>
<step os="slmicro;slemicro">
<para>
Create a directory where the RAID should be mounted to. Typically, devices are mounted on the
<filename>/mnt</filename> directory, however, on &productname; this directory is read-only.
Either you can create a different mount directory or use the read-write shell created by the <command>transactional-update
shell</command> command to modify the <filename>/mnt</filename> directory:
</para>
<substeps>
<step>
<para>Run:</para>
<screen>&prompt.sudo;transactional-update
shell</screen>
</step>
<step>
<para>
Create the mount directory. For example:
</para>
<screen>&prompt.sudo;mkdir /mnt/raid5</screen>
</step>
<step>
<para>
Reboot the system.
</para>
</step>
</substeps>
</step>
<step>
<para>
Mount the device:
</para>
<screen>&prompt.sudo;mount /dev/md1 <replaceable>MOUNT_DIRECTORY</replaceable></screen>
</step>
<step>
<para>
Create an entry in <filename>/etc/fstab</filename> to mount the RAID device automatically
during the boot process. For example:
</para>
<screen>/dev/md01 /mnt/raid5 ext4 defaults 0 0</screen>
</step>
<step>
<para>
Check if there are no errors in <filename>/etc/fstab</filename> by running:
</para>
<screen>&prompt.sudo;mount -av</screen>
</step>
<step>
<para>
Save the RAID configuration to the configuration file <filename>/etc/mdadm.conf</filename>
</para>
<screen>&prompt.sudo;mdadm --detail --scan --verbose &gt;&gt; /etc/mdadm.conf</screen>
</step>
</procedure>
</topic>
Loading