| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-18-2011, 05:53 AM
|
#1
|
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Rep: 
|
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
|
|
|
|
11-19-2011, 04:12 PM
|
#2
|
|
Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 699
Rep: 
|
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 04:19 PM.
Reason: I misremembered.
|
|
|
|
11-19-2011, 04:18 PM
|
#3
|
|
Member
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87
Rep:
|
Quote:
Originally Posted by Adil Boyun
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 04:24 PM.
|
|
|
1 members found this post helpful.
|
11-19-2011, 06:24 PM
|
#4
|
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Original Poster
Rep: 
|
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 02:20 PM.
|
|
|
|
11-20-2011, 04:02 AM
|
#5
|
|
Member
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87
Rep:
|
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 04:04 AM.
Reason: spelling correction
|
|
|
1 members found this post helpful.
|
11-20-2011, 06:06 AM
|
#6
|
|
LQ Newbie
Registered: Nov 2011
Posts: 5
Original Poster
Rep: 
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:24 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|