HOW TO REMOVE/DELETE RAID IN LINUX

In this post we will learn how to remove or delete raid devices in linux . I’m going to first create raid 5 and then show you how to remove it from your linux system

  • First create three partition . As you know Raid 5 requires minimum three harddisks .
  • Make sure all are of equal size .
[root@localhost ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 65399.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57368-65399, default 57368):
Using default value 57368
Last cylinder or +size or +sizeM or +sizeK (57368-65399, default 65399): +1000M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57491-65399, default 57491):
Using default value 57491
Last cylinder or +size or +sizeM or +sizeK (57491-65399, default 65399): +1000M

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (57614-65399, default 57614):
Using default value 57614
Last cylinder or +size or +sizeM or +sizeK (57614-65399, default 65399): +1000M

Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-7): 6
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-7): 5
Hex code (type L to list codes): fd
Changed system type of partition 5 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
  • Mandatory – run partprobe command to save all changes
[root@localhost ~]# partprobe /dev/sda
  • Create raid .
[root@localhost ~]# mdadm --create /dev/md5 --level=5 --raid-devices=3 /dev/sda5 /dev/sda6 /dev/sda7
mdadm: /dev/sda5 appears to contain an ext2fs file system
    size=3951232K  mtime=Wed Jan 25 08:20:49 2017
mdadm: /dev/sda5 appears to be part of a raid array:
    level=raid5 devices=3 ctime=Sat Jan 28 11:11:23 2017
mdadm: /dev/sda6 appears to be part of a raid array:
    level=raid5 devices=3 ctime=Sat Jan 28 11:11:23 2017
mdadm: /dev/sda7 appears to contain an ext2fs file system
    size=3951232K  mtime=Wed Jan 25 08:20:49 2017
mdadm: /dev/sda7 appears to be part of a raid array:
    level=raid5 devices=3 ctime=Sat Jan 28 11:11:23 2017
Continue creating array? yes
mdadm: array /dev/md5 started.

HOW TO REMOVE/DELETE RAID DEVICES IN LINUX

  • To remove raid , first we need to stop .
  • To stop raid , type        =    mdadm   –stop  raidname
  • To remove raid ,type   =    mdadm   –remove raidname
[root@localhost ~]# mdadm --stop /dev/md5
mdadm: stopped /dev/md5
[root@localhost ~]# mdadm --remove /dev/md5

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s