LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-18-2011, 06:53 AM   #1
Adil Boyun
LQ Newbie
 
Registered: Nov 2011
Posts: 5

Rep: Reputation: Disabled
How can I create raid 1 - Centos 5.7 64 minimal installation


Hello,

I have a server working on centos 5.7-64 minimal installation. I have 3 separate physical drives:

120 gb ssd, 2x 3tb disks for storage.

My linux installation is on ssd disk, and I want to make raid 1 for these two 3tb disks and store data, like under /mnt/data.

Can you please tell me the path how this is possible?

Sorry if this is dublicate but I couldn't find information on this using search.

Here are some output of commands I ran for more data:

Code:
[root@CentOS-57-64-minimal tmp]# fdisk -l | grep '^Disk'
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sda: 120.0 GB, 120034123776 bytes
Disk /dev/sdb: 3000.5 GB, 3000592982016 bytes
Disk /dev/sdc: 3000.5 GB, 3000592982016 bytes

[root@CentOS-57-64-minimal tmp]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3            113695432   1427792 106537696   2% /
/dev/sda2               520136     23576    470348   5% /boot

[root@CentOS-57-64-minimal tmp]# fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
64 heads, 32 sectors/track, 114473 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               2        2048     2096128   82  Linux swap / Solaris
/dev/sda2            2049        2560      524288   83  Linux
/dev/sda3            2561      114473   114598912   83  Linux

Disk /dev/sdb: 3000.5 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 3000.5 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-19-2011, 05:12 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 1,701

Rep: Reputation: 433Reputation: 433Reputation: 433Reputation: 433Reputation: 433
Its usually more flexible to build a RAID out of partitions than whole drives. So make sdb1 and sdc1 partitions using gparted, then use mdadm to make them a RAID 1. gparted is graphical and easy to use, but not included by default in most Redhat installations (I wonder why?) mdadm is command line and should be installed.

When I did this recently I did not use the whole disk. I created empty boot and OS partitions at the beginning of the drives in case I wanted to boot from the RAID in the future. So in my case the large RAID partitions were sdb3 and sdc3. I also didn't use all of the space. When you have to replace a drive, you will find out that the new drive will not have the exact same number of blocks as the old drive. If a partition is even 1 block smaller, it won't work as a replacement. Also, you may have a need for some free space, such as for swap. Also, unless something has changed, the max partition size is 2TB. You need to use larger block sizes than 512 bytes to go above that. Probably simpler to just make a couple of 2TB partitions.

The command to make your RAID is now:
Code:
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

Edit: The 2TB limit in fdisk, which some scripts used to check sizes. Most stuff should be using parted now, so it should not be a problem.

Last edited by smallpond; 11-19-2011 at 05:19 PM. Reason: I misremembered.
 
Old 11-19-2011, 05:18 PM   #3
davemguru
Member
 
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87

Rep: Reputation: 40
Quote:
Originally Posted by Adil Boyun View Post
Hello,

I have a server working on centos 5.7-64 minimal installation. I have 3 separate physical drives:

120 gb ssd, 2x 3tb disks for storage.

My linux installation is on ssd disk, and I want to make raid 1 for these two 3tb disks and store data, like under /mnt/data.

Can you please tell me the path how this is possible?

Sorry if this is dublicate but I couldn't find information on this using search.

Here are some output of commands I ran for more data:

Code:
[root@CentOS-57-64-minimal tmp]# fdisk -l | grep '^Disk'
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sda: 120.0 GB, 120034123776 bytes
Disk /dev/sdb: 3000.5 GB, 3000592982016 bytes
Disk /dev/sdc: 3000.5 GB, 3000592982016 bytes

[root@CentOS-57-64-minimal tmp]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3            113695432   1427792 106537696   2% /
/dev/sda2               520136     23576    470348   5% /boot

[root@CentOS-57-64-minimal tmp]# fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
64 heads, 32 sectors/track, 114473 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               2        2048     2096128   82  Linux swap / Solaris
/dev/sda2            2049        2560      524288   83  Linux
/dev/sda3            2561      114473   114598912   83  Linux

Disk /dev/sdb: 3000.5 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 3000.5 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
First you need to partition your drives (sdb and sdc) with parted. Not all versions of fdisk support GPT and your >2TB require GPT.
Code:
parted -s /dev/sdb  mklabel gpt
parted -s /dev/sdc  mklabel gpt
initialises the GPT. Then
Code:
parted -s /dev/sdb mkpart "primary" "ext3" 0TB 2.9TB
parted -s /dev/sdb set 1 "raid" on

parted -s /dev/sdc mkpart "primary" "ext3" 0TB 2.9TB
parted -s /dev/sdc set 1 "raid" on
and then make the raid1 device
Code:
yes| mdadm -C /dev/md2 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1
If you want - you can leave off the "yes |" then you can answer any questions that mdadm may ask.
you will then be left with a the raid1 device /dev/md0 which you now create a filesystem on with
Code:
mke2fs -j /dev/md0
mkdir /mnt/data
mount /dev/md0 /mnt/data


Dave

Last edited by davemguru; 11-19-2011 at 05:24 PM.
 
2 members found this post helpful.
Old 11-19-2011, 07:24 PM   #4
Adil Boyun
LQ Newbie
 
Registered: Nov 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
First of all, really appreciate the help, and the work you put into this. Thank you a lot.
I assume creating array for md2 is a typo, just to indicate for later usage of info.

So far everything went like charm, i dont know if i need to creat a mdadm.conf file with
Code:
# mdadm --detail --scan --verbose > /etc/mdadm.conf
To make mounting permanent, i will add this to fstab, for my situation is it correct to add?
Code:
# echo '/dev/md0 /mnt/data ext3 noatime,rw 0 0' >> /etc/fstab
Final result so far:

Code:
(parted) print all                                                        

Model: ATA OCZ-VERTEX3 (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2147MB  2146MB  primary  linux-swap        
 2      2147MB  2684MB  537MB   primary  ext3              
 3      2684MB  120GB   117GB   primary  ext3              



Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  3001GB  3001GB  ext3         primary  raid 



Model: ATA ST33000651AS (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  3001GB  3001GB  ext3         primary  raid 



Model: Unknown (unknown)
Disk /dev/md0: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start   End     Size    File system  Flags
 1      0.00kB  3001GB  3001GB  ext3
Best regards.

Last edited by Adil Boyun; 11-20-2011 at 03:20 PM.
 
Old 11-20-2011, 05:02 AM   #5
davemguru
Member
 
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87

Rep: Reputation: 40
Quote:
I assume creating array for md2 is a typo
Yes -typo correctly assumed.
Quote:
Code:
# echo '/dev/md0 /mnt/data ext2 noatime,rw 0 0' >> /etc/fstab
"ext2" is also a typo right?
"Yes" to the /etd/mdadm.conf.

My only remaining thought... (Hmmmmmm) is the "physical/logical" sector sizes.
Some newer large capacity drives are using larger physical sector sizes. The ST33000651AS uses 512byte sectors - so, in this case it is not an issue. But, something to think about - should you ever re-use this knowledge.


Dave

Last edited by davemguru; 11-20-2011 at 05:04 AM. Reason: spelling correction
 
2 members found this post helpful.
Old 11-20-2011, 07:06 AM   #6
Adil Boyun
LQ Newbie
 
Registered: Nov 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Code:
 
[root@CentOS-57-64-minimal home1]# mdadm --detail --scan --verbose
mdadm: metadata format 1.00 unknown, ignored.
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=1.00 name=0 UUID=7c7f9ebf:72a8cb15:f1d9c2e8:1c87d4eb
   devices=/dev/sdb1,/dev/sdc1
Direct logic: mk3fs makes ext3, mk2fs should do ext2
I should have checked the output at least
So far everything works like charm, i marked the thread as solved, thanks^2 for help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] RAID 1 on existing CentOS installation learon Red Hat 2 06-14-2011 05:45 PM
Minimal centos via kickstart not working abcdefg Red Hat 5 11-01-2008 01:11 PM
CentOS Installation Problem - Can't recognize logical drives with RAID 16vjohn Linux - Server 5 02-14-2008 07:22 PM
CentOS - Minimal Install harry edwards Linux - Server 4 01-22-2008 06:33 AM
how to create a minimal x window installation? learnfast Linux - Newbie 1 06-28-2005 10:40 AM


All times are GMT -5. The time now is 08:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration