LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-16-2016, 08:24 PM   #1
snatale1
Member
 
Registered: Aug 2003
Location: Richmond, Virginia, US
Distribution: Ubuntu 20.04 / Manjaro
Posts: 439

Rep: Reputation: 48
Setting up RAID 1 on existing drive


Not sure if this should be a HW or SW question, but basically having a hard time figuring out if I can have a drive up and running and then after the fact buy an identical drive and mirror it into a RAID1. Searching brings up yes, and no. I know how RAID works but I've never done it so not sure where to go. Just trying to be cheap for a couple weeks in between drive purchases.
 
Old 06-16-2016, 08:37 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It depends on how the filesystem is.

btrfs will let you do that. As far as I know, none of the others will.

md will NOT do it UNLESS the partition is first initialized as a raid 0 with only one disk. The initialization of the partition as an md device will occupy some of the blocks that would otherwise be used as the superblock. Once initialized as a raid 0 I believe you can then modify it to a raid 1 in degraded mode, then add a second disk. The action of adding the second disk will then replicate the configuration, and copy the contents.

This is because md raids are emulating a raid controller device, and the raid handling is separate from the filesystem.

ah. My post above is all about software raid, not hardware raid.

A hardware raid controller would have its own handling. As to whether it would allow it or not, depends on the controller, and how the disks are handled. Most require some blocks to be used for the raid configuration, and if the controller is not being used in a raid configuration, then these blocks are not initialized, and you are back with the same limitations as with md raid.

Last edited by jpollard; 06-16-2016 at 08:47 PM.
 
Old 06-16-2016, 10:11 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Yes - I'm surprised your searching didn't find this.
Stick the new disk in, partition as appropriate (or not at all), create RAID1 with 2 devices and --missing using the new disk/partition.
Maybe have to reboot to get the new disk/partition(s) recognised. Check /proc/mdstat that everything is ok, mount it, mkfs, copy/rsync.

At this point, for a data disk, you can do a reboot and check it looks ok, then just trash the old disk, re-partition it and add it to the RAID. Simple - it will sync itself across. Fix fstab in need.

If it's your system/boot partitions we are talking about you need to be a little lot more careful - bootloaders and initrd spring immediately to mind. And of course that is distro specific.
 
  


Reply



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
How to setup RAID on existing single drive system? Erik765 Linux - Hardware 1 03-17-2008 03:19 PM
Need help setting up RAID 1 on existing system twn2 Linux - Hardware 2 01-21-2008 11:06 PM
adding a hard drive to an existing software raid array iammisc Linux - Hardware 3 03-01-2006 06:08 PM
Software RAID 1 from Existing Boot Drive johnwyles Linux - General 1 08-05-2005 11:42 AM
Adding ide drive to existing raid 5 help koj333 Linux - Hardware 3 09-28-2003 12:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:30 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration