<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Andy Mareev</title>
    <description>The latest articles on DEV Community by Andy Mareev (@madmannew).</description>
    <link>https://dev.to/madmannew</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F646374%2Fac13e422-4a20-453e-a2f0-5ac1952d02d1.png</url>
      <title>DEV Community: Andy Mareev</title>
      <link>https://dev.to/madmannew</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madmannew"/>
    <language>en</language>
    <item>
      <title>How to Convert LV or MD RAID1 and 0 Into RAID5 Without Losing Data</title>
      <dc:creator>Andy Mareev</dc:creator>
      <pubDate>Thu, 10 Jun 2021 06:46:33 +0000</pubDate>
      <link>https://dev.to/madmannew/how-to-convert-lv-or-md-raid1-and-0-into-raid5-without-losing-data-3mfl</link>
      <guid>https://dev.to/madmannew/how-to-convert-lv-or-md-raid1-and-0-into-raid5-without-losing-data-3mfl</guid>
      <description>&lt;p&gt;In this tutorial, you will learn how to switch from RAID 0 or 1 to RAID 5. How to convert (on Linux, with mdadm or LVM) a software RAID1 (0) system into RAID5 while keeping all the data it stores.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2Fhow-to-convert-lv-or-md-raid1-and-0-to-raid5-without-data-loss.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2Fhow-to-convert-lv-or-md-raid1-and-0-to-raid5-without-data-loss.jpg" alt="How to Convert LV or MD RAID1 and 0 Into RAID5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RAID 0 disk arrays are known for relatively high data access time, and that’s why people choose to use them primarily because of the considerable boost in the speed of read and write operations. However, their reliability and fault-tolerance leave much to be desired. Even if one of the drives is out of order, all the data in such a disk array is going to be lost. Recovering the information from this array type is quite a challenge, but even then, all the data you may be able to extract will certainly be damaged. In fact, this type is not much of a disk array because it offers no redundancy at all.&lt;/p&gt;

&lt;p&gt;On the contrary, RAID 1 is a very reliable and fault-tolerant solution, as all the data is duplicated to the other disk, creating a mirrored copy of the information on the other drive. Still, this approach affects the read and write speeds of the whole array, so it appears to be slower in accessing the data, if compared with RAID 0 systems.&lt;/p&gt;

&lt;p&gt;If you have a spare drive, you can upgrade the existing RAID 1 array to RAID 5. This way, you will enjoy better reliability than RAID 0 could offer, and feel an impressive read/write speed boost in comparison with RAID 1. In the end, you get a RAID 5 system, which is both reliable, fault-tolerant and powerful enough to process your data faster than before.&lt;/p&gt;

&lt;p&gt;How to convert RAID 1 (mirroring) into RAID 5 (parity)&lt;br&gt;
All right, we’ve got a software md_RAID1 system created on a Linux operating system. This array consists of two drives.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F01-en-raid1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F01-en-raid1.jpg" alt="RAID1 system created on a Linux operating system"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to convert it into RAID 5 and then add one more drive, and while doing that we have to make sure that all the data from the disk array doesn’t disappear. There are several files there: photos, videos, documents, and so on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F02-en-raid-files.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F02-en-raid-files.jpg" alt="There are several files there: photos, videos, documents, and so on."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before you start the conversion, it is recommended to back up important information because if you make a mistake while typing commands, important data can be erased.&lt;/p&gt;

&lt;p&gt;Open the terminal, and run this command to make sure that all the operations are performed with superuser rights:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo -i&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and type the password.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F03-en-root.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F03-en-root.jpg" alt="sudo -i"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the disk array is mounted, you need to unmount it with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;umount /dev/md0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;code&gt;umount /mnt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F04-en-unmounting.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F04-en-unmounting.jpg" alt="umount /mnt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the operating system tells you the target is busy, try to force this action:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;umount -f /dev/md0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F05-en-unmounting-linux.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F05-en-unmounting-linux.jpg" alt="umount -f /dev/md0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, you have to stop your RAID 1 system, with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --stop /dev/md0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;(whether it is md0 or another name depends on the path, which needs to be checked)&lt;/p&gt;

&lt;p&gt;where md0 is the identifier for your RAID system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F06-en-stopping-the-array.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F06-en-stopping-the-array.jpg" alt="mdadm --stop /dev/md0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, you can’t stop it if this is the RAID system you boot from, and in this case, you’ll have to use a LiveCD.&lt;/p&gt;

&lt;p&gt;Now you need to overwrite the metadata of the old RAID 1 system; to do it, create a RAID 5 system with the same drives that were included in the RAID 1 system - sdb and sdc - by typing this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --create /dev/md0 -a yes -l 5 -n 2 /dev/sdb1 /dev/sdc1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where l5 sets the array level,&lt;/p&gt;

&lt;p&gt;n2 sets the number of drives it includes, and then these drives are specified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F07-en-reloading-the-metadata.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F07-en-reloading-the-metadata.jpg" alt="mdadm --create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the command is performed, the program will warn you that these drives are already used in a RAID 1 system, so hit Enter to continue.&lt;/p&gt;

&lt;p&gt;To check if the conversion was successful, type this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat /proc/mdstat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F07-en-rebuild-process.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F07-en-rebuild-process.jpg" alt="cat /proc/mdstat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now all you have to do is to wait until RAID 5 is built: the status of this process is shown here, in percent.&lt;/p&gt;

&lt;p&gt;When it is over, the command cat /proc/mdstat will display the following data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F08-en-array-rebuilt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F08-en-array-rebuilt.jpg" alt="cat /proc/mdstat will display the following data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, you can add a new drive to the array, and make it a full-featured RAID 5 system. This new drive will be added as a spare one. Use the following command for this step:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --add /dev/md0 /dev/sdd1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F09-en-add-a-third-drive.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F09-en-add-a-third-drive.jpg" alt="mdadm --add /dev/md0 /dev/sdd1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, extend the RAID system to the three active drives (now including the spare drive) with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --grow /dev/md0 --raid-disks=3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check the result with the command cat /proc/mdstat:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat /proc/mdstat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F10-en-expand-the-raid.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F10-en-expand-the-raid.jpg" alt="cat /proc/mdstat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can see that the RAID system is using three drives - sdb, sdc, sdd and the process of conversion (reshape) has begun.&lt;/p&gt;

&lt;p&gt;Its progress is shown in percent; wait until it is complete.&lt;/p&gt;

&lt;p&gt;In the end, check the disk array for errors with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;e2fsck -f /dev/md0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and use another command to extend it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;resize2fs -p /dev/md0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F11-en-%25D1%2581hecking-for-errors.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F11-en-%25D1%2581hecking-for-errors.jpg" alt="resize2fs -p /dev/md0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, the last command updates the configuration file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --examine --scan &amp;gt;&amp;gt; /etc/mdadm.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F12-en-updating-the-configuration-file.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F12-en-updating-the-configuration-file.jpg" alt="mdadm --examine --scan &amp;gt;&amp;gt; /etc/mdadm.conf"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If there are no errors in the course of performing these commands, all the data existing on your RAID 1 system will be transferred onto the new RAID 5.&lt;/p&gt;

&lt;p&gt;Mount it and check what’s going on: as you can see, all the files are still here, and the array type has changed to RAID 5.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F13-en-all-files-remained-intact.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F13-en-all-files-remained-intact.jpg" alt="The array type has changed to RAID 5"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to convert RAID 0 (striping) into RAID 5 (parity)
&lt;/h2&gt;

&lt;p&gt;However, you can’t use this method to change from RAID 0 to RAID 5 without formatting and losing all the data. Instead, there is a way to convert it quickly with a single command.&lt;/p&gt;

&lt;p&gt;Migration from RAID 0 to RAID 5 is only possible when there are two drives - then RAID 0 coincides with RAID 5 in terms of structure. All the changes will affect the array level only, while the information on the drives remains intact.&lt;/p&gt;

&lt;p&gt;Here is the command that transforms a RAID 0 consisting of two drives into a RAID 5 including three drives.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --grow /dev/md0 --level=5 --raid-devices=3 --add /dev/sdd --backup-file=/tmp/grow_md0.bak&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Before you run it, unmount the array.&lt;/p&gt;

&lt;p&gt;Check the result with the command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat /proc/mdstat&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Wait until the reshape operation is complete.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F14-en-converting-zero-raid-into-fifth.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F14-en-converting-zero-raid-into-fifth.jpg" alt="cat /proc/mdstat"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After changing the array type to RAID 5, you can add more drives with the command I have already mentioned in this tutorial:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mdadm --add /dev/md0 /dev/sdc1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F15-en-adding-drives-to-the-raid.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F15-en-adding-drives-to-the-raid.jpg" alt="mdadm --add /dev/md0 /dev/sdc1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After restarting, the array name will change to RAID 5.&lt;/p&gt;

&lt;p&gt;If the RAID 0 system contains more than two drives, you need to reduce their number, and only then you’ll be able to convert the array to RAID 5.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to convert LVRAID1 into LVRAID5
&lt;/h2&gt;

&lt;p&gt;If you used LVM features to create a RAID system, then you can convert it from one array type to another with the command lvconvert:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lvconvert&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pvdisplay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to view the information on this group of disks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F15-en-see-information-about-the-carriers-included-in-the-raid.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F15-en-see-information-about-the-carriers-included-in-the-raid.jpg" alt="pvdisplay"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to know more about creating MD and LV RAID systems, check one of the previous videos by following the link below.&lt;/p&gt;

&lt;p&gt;YouTube: &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/O3Iq9hx8V7U"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;To start the conversion, unmount the logical volume. Type the command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;umount /dev/vg1/lv1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use the following command to change the RAID level:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lvconvert --type raid5 /dev/vg1/lv1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F16-en-converting-lvm-from-the-first-level-to-the-fifth.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F16-en-converting-lvm-from-the-first-level-to-the-fifth.jpg" alt="lvconvert --type raid5 /dev/vg1/lv1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last step is to add the third drive to the existing group of disks with this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vgextend vg1 /dev/sdd1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When you perform it, the program warns you that the disk is already formatted. Type “y” to confirm your decision and press Enter.&lt;/p&gt;

&lt;p&gt;To make sure that the disk is added to the group, use this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pvdisplay&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you can see the group consists of three disks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F17-en-add-a-new-drive-to-the-group.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F17-en-add-a-new-drive-to-the-group.jpg" alt="pvdisplay"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mount the array again and open it in the file manager: all the data is here, nothing is lost.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F18-en-all-information-saved.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F18-en-all-information-saved.jpg" alt="Mount the array again and open it in the file manager"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to convert LVRAID0 into LVRAID5
&lt;/h2&gt;

&lt;p&gt;The same command is used to change from RAID 0 to RAID 5. The only important step is to add the third disk to the group before you start the conversion; otherwise, you’ll see the warning that you don’t have enough space for this command to run.&lt;/p&gt;

&lt;p&gt;Add the third disk:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vgextend vg1 /dev/sdd1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use the following command to change the RAID level:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lvconvert --type raid5 /dev/vg1/lv1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F19-en-%25D1%2581onvert-raid-lvm-level-1-to-level-5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F19-en-%25D1%2581onvert-raid-lvm-level-1-to-level-5.jpg" alt="lvconvert --type raid5 /dev/vg1/lv1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mount the array and check what information is available. As you can see, all files are here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F20-en-all-information-has-remained-unchanged.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhetmanrecovery.com%2Fpic%2Fblog%2Fa255%2F20-en-all-information-has-remained-unchanged.jpg" alt="Mount the array and check what information is available"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See the &lt;a href="https://hetmanrecovery.com/recovery_news/how-to-convert-lv-or-md-raid1-and-0-to-raid5-without-data-loss.htm" rel="noopener noreferrer"&gt;full article&lt;/a&gt; with all additional video tutorials. Also visit our &lt;a href="https://www.youtube.com/channel/UCu-D9QnPsAPn7AtxL4HXLUg" rel="noopener noreferrer"&gt;Youtube channel&lt;/a&gt;, there are over 400 video tutorials.&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>beginners</category>
      <category>testing</category>
      <category>security</category>
    </item>
    <item>
      <title>How to Recover Data from a BtrFS Drive or RAID System</title>
      <dc:creator>Andy Mareev</dc:creator>
      <pubDate>Wed, 09 Jun 2021 06:59:59 +0000</pubDate>
      <link>https://dev.to/madmannew/how-to-recover-data-from-a-btrfs-drive-or-raid-system-3676</link>
      <guid>https://dev.to/madmannew/how-to-recover-data-from-a-btrfs-drive-or-raid-system-3676</guid>
      <description>&lt;p&gt;From this article, you’ll learn how to recover data from a software BtrFS RAID on Linux. How to create a BtrFS RAID, replace a faulty disk, and how to recover lost data from a damaged disk array.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7ATpHb8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7fnwt9upeqpzrq5vh0x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7ATpHb8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7fnwt9upeqpzrq5vh0x.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Usually, mdadm and lvm are used to create a RAID system in Linux, and you can learn more about them from other videos on our channel.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/8oBAVj9uuqQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In addition to the tools described in this video, another helpful thing you can discover is the integrated RAID support in BtrFS file system. It uses its own means to build and manage disk arrays, so let’s have a closer look at all of its features.&lt;/p&gt;

&lt;h2&gt;
  
  
  BtrFS file system
&lt;/h2&gt;

&lt;p&gt;BtrFS is a modern file system with the integrated Copy on Write feature and RAID support. The core of this option is that old data does not have to be overwritten when copied. As a huge bonus, it makes file recovery after failures and crashes much easier, because an error or interruption during the copying process does not affect the previous condition of the files.&lt;/p&gt;

&lt;p&gt;BtrFS stores metadata separately from the file system data, and its main advantage is that you can use various RAID levels for data and metadata. Another purpose of this journaled file system is to provide a more effective way to manage the storage system and improve data integrity features in Linux.&lt;/p&gt;

&lt;p&gt;Before you can start using BtrFS, it is required to install several tools for file system management, by running the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install btrfs-tools&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NmUSuBX4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/01-linux.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NmUSuBX4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/01-linux.jpg" alt="sudo apt install btrfs-tools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a mount point
&lt;/h2&gt;

&lt;p&gt;You have to create a mount point directory for BtrFS file system before you can build a RAID array.&lt;/p&gt;

&lt;p&gt;Let’s create the directory:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Sudo mkdir –v /data&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where “data” is the directory name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b2AIxVcD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/02-linux.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b2AIxVcD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/02-linux.jpg" alt="Sudo mkdir –v /data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s move on to create a disk array.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a RAID 5
&lt;/h2&gt;

&lt;p&gt;When you create an array, you don’t have to divide drives into partitions, as this file system has no such requirement. You can unite both entire drives or specific partitions into a disk array, and even combine drives and partitions. For illustration, I’ll show you how to use five hard disks to create a RAID5 system.&lt;/p&gt;

&lt;p&gt;To save the trouble of having to enter the root password every time, run the sudo -i command and type the password, and now you can run all commands as administrator.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bcHnwYRJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/03-linux.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bcHnwYRJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/03-linux.jpg" alt="How to create a RAID 5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To build a RAID system, type this command in the terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo mkfs.btrfs -L data -m raid5 -d raid5 -f /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L&lt;/strong&gt; is the mark or name of the file system&lt;/p&gt;

&lt;p&gt;Index:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;d&lt;/strong&gt; sets the type of RAID5 for data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;m&lt;/strong&gt; sets the type of RAID5 for metadata.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;f&lt;/strong&gt; forces creation of BtrFS even if any of the drives is already formatted into a different file system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4isNGgPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/04-linux.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4isNGgPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://hetmanrecovery.com/pic/blog/a260/04-linux.jpg" alt="Create a BTRFS RAID 5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See the &lt;a href="https://hetmanrecovery.com/recovery_news/how-to-recover-data-from-btrfs-raid.htm"&gt;full article&lt;/a&gt; with all additional video tutorials. Also visit our &lt;a href="https://www.youtube.com/channel/UCu-D9QnPsAPn7AtxL4HXLUg"&gt;Youtube channel&lt;/a&gt;, there are over 400 video tutorials.&lt;/p&gt;

</description>
      <category>datascience</category>
    </item>
  </channel>
</rss>
