HOW TO REPLACE RAID PARTITION WITH ANOTHER

In this tutorial we are going to learn how to replace one raid partition with another.

raid1

I’M going to show on this raid which is raid 1

Follow these steps:

  • Create 3 partitions sdb5 sdb6 and sdb7 which we are going to replace later.
[root@localhost ~]# fdisk /dev/sdb
 The number of cylinders for this disk is set to 1634.
 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 (1-1634, default 1):
 Using default value 1
 Last cylinder or +size or +sizeM or +sizeK (1-1634, default 1634): +500M

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

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

Command (m for help): p
 Disk /dev/sdb: 13.4 GB, 13445111808 bytes
 255 heads, 63 sectors/track, 1634 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Device Boot      Start         End      Blocks   Id  System
 /dev/sdb4               1        1634    13125073+   5  Extended
 /dev/sdb5               1          62      497952   83  Linux
 /dev/sdb6              63         124      497983+  83  Linux
 /dev/sdb7             125         186      497983+  83  Linux

Command (m for help): w
 The partition table has been altered!
 Calling ioctl() to re-read partition table.
 Syncing disks.
  • Change its type to raid .
[root@localhost ~]# fdisk /dev/sdb
 The number of cylinders for this disk is set to 1634.
 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): 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): 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): 7
 Hex code (type L to list codes): fd
 Changed system type of partition 7 to fd (Linux raid autodetect)

Command (m for help): p
 Disk /dev/sdb: 13.4 GB, 13445111808 bytes
 255 heads, 63 sectors/track, 1634 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Device Boot      Start         End      Blocks   Id  System
 /dev/sdb4               1        1634    13125073+   5  Extended
 /dev/sdb5               1          62      497952   fd  Linux raid autodetect
 /dev/sdb6              63         124      497983+  fd  Linux raid autodetect
 /dev/sdb7             125         186      497983+  fd  Linux raid autodetect

Command (m for help): w
 The partition table has been altered!
 Calling ioctl() to re-read partition table.
 Syncing disks.
  • Now make Raid1
[root@localhost ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb5 /dev/sdb6

mdadm: array /dev/md0 started.


  • In this raid we have included sdb5 and sdb6 now we are going to replace it with sdb7

t2

[root@localhost ~]# mdadm /dev/md0 --fail /dev/sdb6

mdadm: set /dev/sdb6 faulty in /dev/md0

[root@localhost ~]# mdadm /dev/md0 --remove /dev/sdb6

mdadm: hot removed /dev/sdb6

[root@localhost ~]# mdadm /dev/md0 --add /dev/sdb7

mdadm: added /dev/sdb7
  • You can check your sdb6 is been replaced with sdb7 by
[root@localhost ~]# cat /proc/mdstat

Personalities : [raid6] [raid5] [raid4] [raid1]
 md6 : active raid6 sda8[3] sda7[2] sda6[1] sda5[0]
 995712 blocks level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
 md0 : active raid1 sdb7[1] sdb5[0]
 497856 blocks [2/2] [UU]
 unused devices:

HOW TO CONFIGURE RAID OVER LVM

HOW TO CHANGE IP ADDRESS OF COMPUTER OR TO GET NEW IP

WHAT IS LVM AND HOW TO CONFIGURE ?

 

 

 

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