How to convert linux SWAP memory from RAID1 to RAID0?
Start with:
2 exact size swap formatted partitions (/dev/sdc5 and /dev/sdd5) on 2 physically separate disks that are used via Software RAID
(named md127, located /dev/md/s) in RAID 1 (Mirroring)
cat /proc/mdstat
would show for md127 something like:
md127 : active raid1 sdc5[2] sdd5[0]
7806976 blocks super 1.2 [2/2] [UU]
The task is to use the same:
2 exact size swap formatted partitions (/dev/sdc5 and /dev/sdd5) on 2 physically separate disks that are used via Software RAID
(named md127, located /dev/md/s) in RAID 0 (Striping)
cat /proc/mdstat
would show for md127 something like:
md127 : active raid0 sdc5[2] sdd5[0]
15613952 blocks super 1.2 64k chunks
Convert SWAP /dev/md/s from RAID1 to RAID0 with mdadm
For this you need to know:
- the difference between RAID0 and RAID1
- when the Operating System uses SWAP partition (for ex: when you are about to run out of free available physical memory)
- how to monitor the memory usage (via a tool like conky)
Best Answer
To start you may want to check the details of /dev/md/s
Then "grow" the RAID to RAID0.
This will loose one partition, but that's ok with us:
Then add the missing partition back using the command below. This will temporary change to a RAID4 and convert to RAID0 when completed
To check progress you could use: