|
Written by Tom Hirt
|
|
Monday, 15 June 2009 12:29 |
|
How-to Remove RAID Devices
Continuing with our Linux RAID How-to series, in this KB, we will show you how to remove a Linux software RAID device.
Typically, we remove devices from a RAID array because we want to re-purpose the device(s) for other use. Removing a device from an array is destructive and will destroy the entire array so proceed with caution.
Note: If you are trying to remove a failed device from an array, see our Removing Failed RAID Devices KB.
- Backup your data! Ensure you have a full backup of your data before proceeding. Any data on the array will be lost once we remove a device from the array.
- If the array is mounted, unmount the array before proceeding
| [root@Linux01 TCPDumpLV]# df -kh |
Filesystem
|
Size
|
Used |
Avail |
Use% |
Mounted on |
/dev/mapper/VolGroup00-LogVol04
|
3.9G |
2.2G |
1.6G |
59% |
/ |
| /dev/sda1 |
99M
|
12M
|
82M
|
13% |
/boot |
| tmpfs |
1006M
|
0
|
1006M
|
0% |
/dev/shm |
| /dev/mapper/VolGroup00-LogVol00 |
992M
|
41M
|
901M
|
5%
|
/home |
| /dev/mapper/VolGroup00-LogVol02 |
992M
|
69M
|
872M
|
8%
|
/tmp |
| /dev/mapper/VolGroup00-LogVol03 |
2.0G
|
152M
|
1.7G
|
9%
|
/var |
| /dev/md0 |
7.9G
|
147M
|
7.4G
|
2%
|
/RAID5 |
|
Note: You can see /dev/md0 is mounted on /RAID5
[root@Linux01 ~]# umount /dev/md0 [root@Linux01 ~]#
|
- Note the devices that make-up the array
[root@Linux01 ~]# mdadm --detail /dev/md0 /dev/md0:
|
| Version |
: |
00.90.03
|
Creation Time
|
: |
Mon Jun 15 14:28:48 2009 |
Raid Level
|
: |
raid5 |
Array Size
|
: |
8385664 (8.00 GiB 8.59 GB) |
Used Dev Size
|
: |
4192832 (4.00 GiB 4.29 GB) |
Raid Devices
|
: |
3 |
Total Devices
|
: |
3 |
| Preferred Minor |
: |
0 |
Persistence
|
: |
Superblock is persistent |
|
:
|
|
Update Time
|
: |
Mon Jun 15 15:26:40 2009 |
State
|
: |
clean |
Active Devices
|
: |
3 |
Working Devices
|
: |
3 |
Failed Devices
|
: |
0 |
Spare Devices
|
: |
0 |
|
:
|
|
Layout
|
: |
left-symmetric |
Chunk Size
|
: |
64K |
|
:
|
|
UUID
|
: |
9a37eac9:0525c02f:cf141ece:af0de2a7 |
Events
|
: |
0.2 |
|
| Number |
Major
|
Minor
|
RaidDevice
|
State
|
0
|
8
|
17 |
0
|
active sync /dev/sdb1 |
1
|
8 |
33 |
1 |
active sync /dev/sdc1 |
2
|
8 |
49 |
2 |
active sync /dev/sdd1 |
|
|
Note: /dev/sdb1, /dev/sdc1 and /dev/sdd1 makeup /dev/md0
- Stop the array
[root@Linux01 /]# mdadm -S /dev/md0 mdadm: stopped /dev/md0 [root@Linux01 /]# |
- Zero out each of the superblock's of the devices that belongs to the RAID array
[root@Linux01 /]# mdadm --zero-superblock /dev/sdb1 [root@Linux01 /]# mdadm --zero-superblock /dev/sdc1 [root@Linux01 /]# mdadm --zero-superblock /dev/sdd1 [root@Linux01 /]# |
Note: Zeroing the superblocks will destroy all the data on the array
- Remove the DEVICE and ARRAY entry's associated with the array from /etc/mdadm.conf
DEVICE /dev/sdb1 /dev/sdc1 /dev/sdd1 ARRAY /dev/md0 level=raid5 num-devices=3 devices=/dev/sdb1,/dev/sdc1,/dev/sdd1 |
- Remove the array from /etc/fstab
| /dev/md0 |
/RAID5
|
ext3 |
defaults |
0 |
0 |
|
Nice work! You now know how to remove a RAID device. Good luck!
Add this page to your favorite website
|
|
Last Updated on Tuesday, 16 June 2009 13:28 |