Score:-1

Is it possible to "undo" a raid1 configuration

it flag
Ely

How can I reconfigure a raid1 so that it is not raid1 anymore and without loss of data? I do not want raid.

I find myself with a server with predefined images that have a software raid1 setup. My guess is that there are 2 SSD disks of 1 GB size but I am not sure. Anyway, I'd like to get rid of the raid.

I do not need a raid1 setup. I would like to change that into a normal disk layout without raid and without loss of data. I am not sure if that is possible and I am not sure how to start.

I'll try to provide the information that I believe could give a good start to analyze. Please let me know if other information is needed and I will try my best to provide that.

Information of fdisk -l:

Disk /dev/loop0: 99,37 MiB, 104185856 bytes, 203488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 66,38 MiB, 69591040 bytes, 135920 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 66,4 MiB, 69619712 bytes, 135976 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 89,9 MiB, 93417472 bytes, 182456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 61,75 MiB, 64729088 bytes, 126424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 894,26 GiB, 960197124096 bytes, 1875385008 sectors
Disk model: KCD51LUG960G                            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4FE276C7-2079-4748-8EDE-F2AD23CF0096

Device            Start        End    Sectors  Size Type
/dev/nvme0n1p1     2048       6143       4096    2M BIOS boot
/dev/nvme0n1p2     6144   58593279   58587136   28G Linux RAID
/dev/nvme0n1p3 58593280   78125055   19531776  9,3G Linux swap
/dev/nvme0n1p4 78125056 1875382271 1797257216  857G Linux RAID


Disk /dev/nvme1n1: 894,26 GiB, 960197124096 bytes, 1875385008 sectors
Disk model: KCD51LUG960G                            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6496C65A-EEF2-4B3E-AE51-232E4BE14414

Device            Start        End    Sectors  Size Type
/dev/nvme1n1p1     2048       6143       4096    2M BIOS boot
/dev/nvme1n1p2     6144   58593279   58587136   28G Linux RAID
/dev/nvme1n1p3 58593280   78125055   19531776  9,3G Linux swap
/dev/nvme1n1p4 78125056 1875382271 1797257216  857G Linux RAID


Disk /dev/md4: 856,102 GiB, 920195497984 bytes, 1797256832 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md2: 27,96 GiB, 29996482560 bytes, 58586880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg00-usr: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg00-var: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg00-home: 836,102 GiB, 898717712384 bytes, 1755308032 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Information of lsblk:

NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0             7:0    0  99,4M  1 loop  /snap/core/11187
loop1             7:1    0  66,4M  1 loop  /snap/lxd/20806
loop2             7:2    0  66,4M  1 loop  /snap/lxd/20840
loop3             7:3    0  89,1M  1 loop  /snap/core/8268
loop4             7:4    0  61,7M  1 loop  /snap/core20/1026
nvme0n1         259:0    0 894,3G  0 disk  
├─nvme0n1p1     259:2    0     2M  0 part  
├─nvme0n1p2     259:3    0    28G  0 part  
│ └─md2           9:2    0    28G  0 raid1 /
├─nvme0n1p3     259:4    0   9,3G  0 part  [SWAP]
└─nvme0n1p4     259:5    0   857G  0 part  
  └─md4           9:4    0   857G  0 raid1 
    ├─vg00-usr  253:0    0    10G  0 lvm   /usr
    ├─vg00-var  253:1    0    10G  0 lvm   /var
    └─vg00-home 253:2    0   837G  0 lvm   /home
nvme1n1         259:1    0 894,3G  0 disk  
├─nvme1n1p1     259:6    0     2M  0 part  
├─nvme1n1p2     259:7    0    28G  0 part  
│ └─md2           9:2    0    28G  0 raid1 /
├─nvme1n1p3     259:8    0   9,3G  0 part  [SWAP]
└─nvme1n1p4     259:9    0   857G  0 part  
  └─md4           9:4    0   857G  0 raid1 
    ├─vg00-usr  253:0    0    10G  0 lvm   /usr
    ├─vg00-var  253:1    0    10G  0 lvm   /var
    └─vg00-home 253:2    0   837G  0 lvm   /home

Information of df -h:

Filesystem             Size  Used Avail Use% Mounted on
udev                    32G     0   32G   0% /dev
tmpfs                  6,3G  1,5M  6,3G   1% /run
/dev/md2                28G  536M   27G   2% /
/dev/vg00/usr          9,8G  2,6G  6,8G  28% /usr
tmpfs                   32G     0   32G   0% /dev/shm
tmpfs                  5,0M  4,0K  5,0M   1% /run/lock
tmpfs                   32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/vg00-var   9,8G  983M  8,4G  11% /var
/dev/mapper/vg00-home  824G  363M  790G   1% /home
/dev/loop0             100M  100M     0 100% /snap/core/11187
/dev/loop2              67M   67M     0 100% /snap/lxd/20840
/dev/loop1              67M   67M     0 100% /snap/lxd/20806
/dev/loop3              90M   90M     0 100% /snap/core/8268
/dev/loop4              62M   62M     0 100% /snap/core20/1026
tmpfs                  6,3G     0  6,3G   0% /run/user/1000

You can see in the above information that the /home directory is mounted to a partition of almost 900 GB size. I do not need raid1 for that part and I hope I could double that size for usage by removing raid1. That is my motivation. Any alternative to removing raid1 which allows me to double the size of the /home is welcome.

djdomi avatar
za flag
Remove the disk from raid clean it and mount it
br flag
Why don't you want RAID?
it flag
Ely
Hi @Chopper3 - the reason is that I need the space for the home directory. I am looking for a way to to get rid of the redundant disk space (approx. 900 GB) and add that to the home directory so that my home directory is then 900 GB larger.
br flag
But why not just have larger disks so you can keep them as R1?
it flag
Ely
I am not sure if I understand. I cannot change the physical parts. Do you mean that I can modify the raid so that I can achieve my goal?
br flag
Why can't you change the physical parts?
it flag
Ely
Dedicated server is remote. I asked if we can change for 1 2GB disk and without raid. Unfortunately the provide only that configuration with that image. It is not a cloud server, it is a dedicated server.
Score:1
us flag

Easiest way is to reinstall the system without RAID 1.

If that is not possible, then you need to first take backup of current system and then start into a recovery system to move partitions around.

These are high level instructions of the steps to take. Notice that /usr and /var directories are moved from their own partitions to / partition. This can cause problems in the future, if /var directory grows to fill the root partition.

After booting up the recovery system:

  1. Mount /dev/md2 to /mnt
  2. Create /mnt2 directory.
  3. Mount /dev/vg0-usr to /mnt2.
  4. Move all files from /mnt2 to /mnt/usr.
  5. Unmount /dev/vg0-usr.
  6. Mount /dev/vg0-var to /mnt2.
  7. Move all files from /mnt2 to /mnt/var.
  8. Unmount /dev/vg0-var.
  9. Mount /dev/vg0-home to /mnt2.
  10. Move all files from /mnt2 to /mnt/home.
  11. Unmount /dev/vg0-home.

Now, the /dev/md4 device and volume groups under it can be removed.

  1. Run vgchange -a n vg0 to deactivate vg0 volume group.
  2. Run vgremove vg0 to remove the group.
  3. Run mdadm --stop /dev/md4 to stop RAID device
  4. Run mdadm --remove /dev/md4 to remove the RAID device.

Create a RAID0 array for new volume group and create logical volume for /home:

  1. Run mdadm --create /dev/md4 /dev/nvme0n1p2 /dev/nvme1n1p4 --level=0 --raid-devices=2
  2. Run pvcreate /dev/md4.
  3. Run vgcreate vg0 /dev/md4.
  4. Run lvcreate -l 100%VG -n home vg0
  5. Run mkfs.ext4 /dev/vg0-home
  6. Run mount /dev/vg0-home /mnt2 to mount new home directory.
  7. Move files from /mnt/home to /mnt2.

Last step is to modify fstab so that system doesn't try to mount non-existing logical volumes during startup. Edit /mnt/fstab and remove lines that contain /dev/vg0-var or /dev/vg0-usr.

After these steps, you can reboot the machine and your /home should be what you wanted.

it flag
Ely
Thank you very much Tero. I appreciate very much your help. I believe that is exactly what I was looking for (but I was not capable enough to deal with the terms and concepts yet). I will give it a try and feed back.
it flag
Ely
I had a look and benefitted along the way to learn the steps. It works well. Excellent answer. I thank you very much.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.