{"id":503,"date":"2025-10-31T13:02:42","date_gmt":"2025-10-31T10:02:42","guid":{"rendered":"https:\/\/admin.danychrys.ro:4433\/?p=503"},"modified":"2025-11-02T09:34:24","modified_gmt":"2025-11-02T06:34:24","slug":"503-2","status":"publish","type":"post","link":"https:\/\/danychrys.go.ro\/web\/503-2\/","title":{"rendered":"How to Install RAID1 on Ubuntu 24.04"},"content":{"rendered":"<h3 dir=\"auto\"><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">PARTITION HARD DISKS<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">The first thing we\u2019ll need to do to configure our hard disks is to partition them as Linux RAID auto.<\/span><br \/>\n<span style=\"color: #ff0000; font-family: arial, helvetica, sans-serif;\"><strong>STEP1<\/strong><\/span><br \/>\n<span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">We can see our hard disks by using the fdisk command. This will show us how they are named, which we will need for future commands. As you can see in the screenshot below, our disks are called \/dev\/sdb and \/dev\/sdc. These disks are just raw storage at the moment \u2013 they don\u2019t have a partition table or anything else configured.<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">fdisk -l<\/pre>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-568 size-large\" src=\"https:\/\/admin.danychrys.ro:4433\/wp-content\/uploads\/2025\/10\/01-1024x805.png\" alt=\"\" width=\"1024\" height=\"805\" srcset=\"https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/01-1024x805.png 1024w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/01-300x236.png 300w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/01-768x604.png 768w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/01.png 1396w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif;\"><em><span style=\"color: #99ccff;\">fdisk shows our two disks that we plan to use for our RAID 1 setup<\/span><\/em><\/span><br \/>\n<span style=\"color: #ff0000; font-family: arial, helvetica, sans-serif;\"><strong>STEP2<\/strong><\/span><br \/>\n<span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">Use the following command to begin partitioning the first disk. This will open up the fdisk menu. Substitute your own disk name if yours is different.<br \/>\n<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">fdisk \/dev\/sdb<\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;\"><span style=\"color: #ff0000;\"><strong>STEP3<\/strong><\/span>\r\n<span style=\"color: #99ccff;\">We will enter the following commands into the fdisk prompts in order to create a new partition and configure it as Linux RAID autodetect.<\/span>\r\n<span style=\"color: #99ccff;\">1. Enter <span style=\"color: #ff0000;\">n<\/span> to create a new partition.<\/span>\r\n<span style=\"color: #99ccff;\">2. Enter <span style=\"color: #ff0000;\">p<\/span> to mark this as a primary partition.<\/span>\r\n<span style=\"color: #99ccff;\">3. Enter <span style=\"color: #ff0000;\">1<\/span> for the partition number.<\/span>\r\n<span style=\"color: #99ccff;\">4. For first and last sector (2 prompts), just press the enter key for default response.<\/span>\r\n<span style=\"color: #99ccff;\">5. Enter <span style=\"color: #ff0000;\">t<\/span> to select the partition we\u2019ve just created.<\/span>\r\n<span style=\"color: #99ccff;\">6. Enter <span style=\"color: #ff0000;\">fd<\/span> to configure Linux RAID autodetect on the partition.<\/span>\r\n<span style=\"color: #99ccff;\">7. Enter <span style=\"color: #ff0000;\">w<\/span> to write all these changes to the disk.\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-569 size-large\" src=\"https:\/\/admin.danychrys.ro:4433\/wp-content\/uploads\/2025\/10\/02-1024x809.png\" alt=\"\" width=\"1024\" height=\"809\" srcset=\"https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/02-1024x809.png 1024w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/02-300x237.png 300w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/02-768x607.png 768w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/02-1536x1214.png 1536w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/02.png 1546w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/span><\/span><\/pre>\n<pre><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\"><em>Partitioning the hard disk<\/em>\r\n<span style=\"color: #ff0000;\"><strong>STEP4<\/strong><\/span>\r\nWe now need to do the exact same steps for our second disk. In our case, that would be disk \/dev\/sdc. Repeat Step 2 and Step 3 for your second disk. Afterwards, you should be able to see your newly configured RAID partitions with the fdisk command.\r\n<\/span><\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">fdisk -l<\/pre>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-570 size-large\" src=\"https:\/\/admin.danychrys.ro:4433\/wp-content\/uploads\/2025\/10\/03-1024x945.png\" alt=\"\" width=\"1024\" height=\"945\" srcset=\"https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/03-1024x945.png 1024w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/03-300x277.png 300w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/03-768x709.png 768w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/03-1536x1417.png 1536w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/03.png 1575w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif;\"><em><span style=\"color: #99ccff;\">Both drives have been partitioned as Linux RAID autodetect<\/span><\/em><\/span><\/p>\n<h3><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">CREATE RAID DEVICE<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">Now that we have our hard drives properly partitioned, we can use mdadm to create a RAID device with the following command. Remember that even though we have two hard drives, the system will see them as a single device and mirroring will happen in the background.<br \/>\n<span style=\"color: #ff0000;\"><strong>STEP1<\/strong><\/span><br \/>\nCreate a RAID array called \/dev\/md0 with this command, substituting your own drive names as necessary.<br \/>\n<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mdadm --create --verbose \/dev\/md0 --level=1 --raid-devices=2 \/dev\/sdb \/dev\/sdc<\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;\"><span style=\"color: #ff0000;\"><strong>STEP2<\/strong><\/span>\r\n<span style=\"color: #99ccff;\">Next, put a file system on the device. We\u2019ll use ext4 in this example.\r\n<\/span><\/span><\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mkfs.ext4 \/dev\/md0<\/pre>\n<p style=\"text-align: justify;\"><span style=\"color: #ff0000; font-family: arial, helvetica, sans-serif;\"><strong>STEP3<\/strong><\/span><br \/>\n<span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">Now, make a directory to where you can mount the newly created RAID device. And then mount the device there.<br \/>\n<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mkdir -p \/mnt\/raid1<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mount \/dev\/md0 \/mnt\/raid1<\/pre>\n<pre><span style=\"font-family: arial, helvetica, sans-serif;\"><span style=\"color: #ff0000;\"><strong>STEP4<\/strong><\/span>\r\n<span style=\"color: #99ccff;\">Your RAID array should now be accessible at the mount point you defined.\r\n<\/span><\/span><\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">cd \/mnt\/raid1<\/pre>\n<pre><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">We can access our mounted RAID array and also use the df command to view details about it<\/span><\/pre>\n<h3><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">CONFIGURE PERSISTENT RAID MOUNT<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">The only issue now is that your RAID mount will not survive a reboot. To avoid needing to manually mount it every time, we can configure the fstab file. We\u2019ll also save our mdadm configuration in the following steps.<br \/>\n<span style=\"color: #ff0000;\"><strong>STEP1<\/strong><\/span><br \/>\nEdit the fstab file with nano or your favorite text editor,<br \/>\n<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">nano \/etc\/fstab<\/pre>\n<pre><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">and add the following line.<\/span><\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\/dev\/md0 \/mnt\/raid1 ext4 defaults 0 0<\/pre>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-571 size-large\" src=\"https:\/\/admin.danychrys.ro:4433\/wp-content\/uploads\/2025\/10\/05-1024x481.png\" alt=\"\" width=\"1024\" height=\"481\" srcset=\"https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/05-1024x481.png 1024w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/05-300x141.png 300w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/05-768x361.png 768w, https:\/\/danychrys.go.ro\/web\/wp-content\/uploads\/2025\/10\/05.png 1530w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif;\"><em><span style=\"color: #99ccff;\">Adding the RAID mount to fstab file<br \/>\n<\/span><\/em><span style=\"color: #ff0000;\"><strong>STEP2<\/strong><\/span><span style=\"color: #99ccff;\"><br \/>\n<\/span><span style=\"color: #99ccff;\">Next, use the following command to save your current mdadm configuration.<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mdadm -D --scan &gt;&gt; \/etc\/mdadm\/mdadm.conf<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">update-initramfs -u -k all<\/pre>\n<p style=\"text-align: justify;\"><span style=\"color: #99ccff; font-family: arial, helvetica, sans-serif;\">That\u2019s all there is to it. If you\u2019ve made it this far, you should now have a working RAID 1 array that stays mounted even after a system reboot.<\/span><\/p>\n<p>&nbsp;<\/p>\n<div data-v-4edbe80f=\"\" data-qa=\"layout-element-wrapper:ztorew\">\n<pre><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PARTITION HARD DISKS The first thing we\u2019ll need to do to configure our hard disks is to partition them as Linux RAID auto. STEP1 We can see our hard disks by using the fdisk command. This will show us how they are named, which we will need for future commands. As you can see in&hellip;<\/p>\n","protected":false},"author":1,"featured_media":526,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-5","description-off"],"_links":{"self":[{"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/posts\/503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/comments?post=503"}],"version-history":[{"count":24,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/posts\/503\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/posts\/503\/revisions\/577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/media\/526"}],"wp:attachment":[{"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/media?parent=503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/categories?post=503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/danychrys.go.ro\/web\/wp-json\/wp\/v2\/tags?post=503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}