buy tb500

Raid and Sync in Linux

if you want to see the raid sync live then you can use the following command

watch cat /proc/mdstat

if you don’t want to see life, you just want to see finish or not then you need to use the below command

cat /proc/mdstat

or

more /proc/mdstat

for example if you are using raid1 and one of the hard disk got issue, then you need to change the hard disk and sync it with the other hard disk, you want to make mirror, so you need to follow the below instruction

to see the partition list you need to run the below command

fdisk -l

then you will see almost same like the below result

root@bear1 [/home/wpcsbco]# fdisk -l

Disk /dev/sda: 1500.0 GB, 1500084436992 bytes

255 heads, 63 sectors/track, 182374 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      208813+  83  Linux

/dev/sda2              27        5248    41945715   82  Linux swap / Solaris

/dev/sda3            5249        8381    25165822+  83  Linux

/dev/sda4            8382      182374  1397598772+   5  Extended

/dev/sda5            8382       10209    14683378+  83  Linux

/dev/sda6           10210       12037    14683378+  83  Linux

/dev/sda7           12038       12298     2096451   83  Linux

/dev/sda8           12299      182374  1366135438+  83  Linux

Disk /dev/sdb: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       39162   314568733+  83  Linux

Sda1 or 2 or 3 mean the patrrtion in the hard disk

but sda or sdb or sdc mean the hard disk device,

once you plug in the hard disk to the server, then you need to run Fdisk -l to see the new hard disk already added as sdb or sdc like that

for example if the new hard disk added as sdb then you need to make the partition before syn, and make sure the partition same like the first hard disk partition

for example the first harddisk partition is below

(Figure 2)

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          26      208813+  83  Linux

/dev/sda2              27        5248    41945715   82  Linux swap / Solaris

/dev/sda3            5249        8381    25165822+  83  Linux

/dev/sda4            8382      182374  1397598772+   5  Extended

/dev/sda5            8382       10209    14683378+  83  Linux

/dev/sda6           10210       12037    14683378+  83  Linux

/dev/sda7           12038       12298     2096451   83  Linux

/dev/sda8           12299      182374  1366135438+  83  Linux

How to get the above result? you need to run this command  fdisk /dev/sda

Then after that you need to press “P” command to show the partition details

you make sure that you write down all the details then after that you need to press “q” to quit

and go enter to new hard disk to make the partition first

for example the new harddisk is sdb

fdisk /dev/sdb

then press p you will see nothing there, then you need to press  “n” to create the new partition

Once you press “n” then you will get two option

1- Extended

2- Primary

then you need to select primary

then will ask you the block sector starting point, you can get it from the main hard disk , refer to figure (2) , be inform that you are now working to do the sdb1 which is the first partition, and also will ask you about the end point, you can get it from the main hard disk which is form figure (2) why we use the result of hard disk one in the hard disk two? because they are must be same partition then the sync will be working fine, because raid1 mean two hard working as one hard, the second hard will be the mirror for the first hard disk

then after the end point you need to press “t” to select the fs type (file system type, which is mean linux, you can refer to figure (2) you will see linux using ID 83, that mean we need to use the same here in the second hard disk

that mean t used to select the file system type

“notes”

if you want to list and see all the tpye then you need to press “L” then you will see all the fs type, which is even you will find linux there using 83

after you done the partition for the sdb1 then you need to repeat the same step for sdb2 which is again press n to create the partition by referring to figure 2 and also t to select the file system type, which is i can see in the figure two that sda2 using swap which is 82, so that mean you need to use it for sdb2 as well

in the end to save what you have done then you need to press “w” which is mean write

or if you want to quit then you need to press “q”

———————–

i will list all the command used

p for list of partition

n for create partition

l for list of the file system type

w to save the change

q to quit

That is all and thank you.

Leave a Reply