Hi, I had one drive of a two-drive volume fail recently. Discovered what I thought was RAID1 was actually RAID0 data with RAID1 metadata... but fortunately the drive that died went slowly and I got my data off. Anyway... I bought one drive to replace the failing one. I''d like to end up with RAID1. Back in July I set up a server for my brother and (unless I''m forgetting a different path we ended up taking), I thought what I did was: 1. mkfs.btrfs on a single drive but tell it to use RAID1 2. copy data on 3. once the second drive for the RAID1 was available, add it to the volume and rebalance (or something) Since I had to get all the data off the volume with the failing drive, I tried doing the above. All my data is on the new drive, but when I add the other good drive to the volume, I just see it as a volume containing two drives, not as RAID1. Is there any way for me to get my current single disk volume into a RAID1 volume by adding the other drive? I didn''t save the reference, but I thought I read something last night about being able to create a "RAID1" volume with a single disk as having been a bug. Thanks, James. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 23, 2012 at 12:36 AM, James <torpesco@gmail.com> wrote:> I bought one drive to replace the failing one. I''d like to end up with > RAID1. Back in July I set up a server for my brother and (unless I''m > forgetting a different path we ended up taking), I thought what I did > was: > 1. mkfs.btrfs on a single drive but tell it to use RAID1 > 2. copy data on > 3. once the second drive for the RAID1 was available, add it to the > volume and rebalance (or something)I must be mixing memories. Maybe that''s what I did to end up with the volume that turned out to be RAID0 for the data. On a whim, even thought btrfs filesystem df /path showed no indications of RAID after adding the second drive, I issued a balance command. I ran ''df'' right away and now see the results I don''t want -- RAID0 data, RAID1 metadata. Ctrl-C doesn''t seem to be aborting the balance. Especially with the currently inflated HDD prices compared to a few months ago, I can''t afford to go out and buy an extra drive just to facilitate turning two drives into a mirror. Is there another way? Thanks, James.> > Since I had to get all the data off the volume with the failing drive, > I tried doing the above. All my data is on the new drive, but when I > add the other good drive to the volume, I just see it as a volume > containing two drives, not as RAID1. > > Is there any way for me to get my current single disk volume into a > RAID1 volume by adding the other drive? I didn''t save the reference, > but I thought I read something last night about being able to create a > "RAID1" volume with a single disk as having been a bug. > > Thanks, > James.-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 23, 2012 at 12:52:11AM -0800, James wrote:> On Mon, Jan 23, 2012 at 12:36 AM, James <torpesco@gmail.com> wrote: > > I bought one drive to replace the failing one. I''d like to end up with > > RAID1. Back in July I set up a server for my brother and (unless I''m > > forgetting a different path we ended up taking), I thought what I did > > was: > > 1. mkfs.btrfs on a single drive but tell it to use RAID1 > > 2. copy data on > > 3. once the second drive for the RAID1 was available, add it to the > > volume and rebalance (or something)Why not just create the filesystem as RAID-1 in the first place? # mkfs.btrfs -d raid1 -m raid1 /dev/sda1 /dev/sdb1 Then you can restore from your backups. You do have backups, right? (Remember, this is a filesystem still marked as "experimental").> I must be mixing memories. Maybe that''s what I did to end up with the > volume that turned out to be RAID0 for the data. On a whim, even > thought btrfs filesystem df /path showed no indications of RAID after > adding the second drive, I issued a balance command. I ran ''df'' right > away and now see the results I don''t want -- RAID0 data, RAID1 > metadata. Ctrl-C doesn''t seem to be aborting the balance.Yes, balances are not interruptible right now. The restriper patches (in 3.3-rc1) will allow you to monitor balance progress and stop/restart them. They will also allow you to change RAID levels on the fly, which is what you were asking for in the first place. Hugo. -- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk == PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- There''s an infinite number of monkeys outside who want to --- talk to us about this new script for Hamlet they''ve worked out!
On Mon, Jan 23, 2012 at 1:25 AM, Hugo Mills <hugo@carfax.org.uk> wrote:> Why not just create the filesystem as RAID-1 in the first place? > > # mkfs.btrfs -d raid1 -m raid1 /dev/sda1 /dev/sdb1As I said, I''ve only got two working drives large enough at present.> Then you can restore from your backups. You do have backups, right? > (Remember, this is a filesystem still marked as "experimental").Yes, I know. :) I just have remote backups, though, so while I could go with those I''d prefer to avoid a long download or shipping a drive.> Yes, balances are not interruptible right now. The restriper > patches (in 3.3-rc1) will allow you to monitor balance progress and > stop/restart them. They will also allow you to change RAID levels on > the fly, which is what you were asking for in the first place.Perfect. Since I do have the backup, maybe I''ll just wait for that. Worst case, if I am unlucky enough to find a bad bug, I''ll resort to restoring from the backup. :) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
James posted on Mon, 23 Jan 2012 13:17:53 -0800 as excerpted:> On Mon, Jan 23, 2012 at 1:25 AM, Hugo Mills <hugo@carfax.org.uk> wrote: >> Why not just create the filesystem as RAID-1 in the first place? >> >> # mkfs.btrfs -d raid1 -m raid1 /dev/sda1 /dev/sdb1 > > As I said, I''ve only got two working drives large enough at present. > >> Then you can restore from your backups. You do have backups, right? >> (Remember, this is a filesystem still marked as "experimental"). > > Yes, I know. :) I just have remote backups,First post to the list, as I''m just planning my switch to btrfs... due to which I just read much of the wiki and thus have it fresh in mind... Take a look at the UseCases page on the wiki. There''s several items of interest there that should be very useful to you right now. Here''s the link altho the below actually has a bit more detail than the wiki (but the wiki obviously has other useful information not apropos to this situation): https://btrfs.wiki.kernel.org/articles/u/s/e/UseCases_8bd8.html First: Creating a btrfs-raid-1 in "degraded mode", that is, with a missing drive, to be added later: Apparently it''s not possible to do that directly yet, but there''s a trick to work around the issue that sounds like just what you need ATM. The idea is to create a "small" (the example in the wiki uses 4 GB, I guess I''m getting old as that doesn''t seem all that small to me!!) "fake" device using loopback to serve as the "missing" device, create the filesystem specifying raid-1 for both data and metadata (-m raid1 -d raid1) giving mkfs both the real and loopback devices to work with, then delete the loopback device and remove the file backing it, so that all that''s left is the single "real" device: dd if=/dev/zero of=/tmp/empty bs=1 count=0 seek=4G losetup /dev/loop1 /tmp/empty mkfs.btrfs -m raid1 -d raid1 /dev/sda1 /dev/loop1 losetup -d /dev/loop1 rm /tmp/empty I immediately thought of the possibility of sticking that temporary loopback device file on a USB thumbdrive if necessary... You should then be able to copy everything over to the new btrfs operating in degraded raid-1. After testing to ensure it''s there and usable (bootable if that''s your intention), you can blank the old drive. Adding it in to complete the raid-1 is then done this way: mount /dev/sda1 /mnt btrfs dev add /dev/sdb1 /mnt Second: This note might explain why you ended up with raid-0 where you thought you had raid-1: (kernel 2.6.37) Simply creating the filesystem with too few devices will result in a RAID-0 filesystem. (This is probably a bug). Third: To verify that btrfs is using the raid level you expect: On a 2.6.37 or later kernel, use btrfs fi df /mountpoint The required support was broken accidentally in earlier kernels, but has now been fixed. NB: As I mentioned above I''m only researching btrfs for my systems now, so obviously have no clue how the above suggestions work in practice. They''re simply off the wiki. (Now to send this via gmane.org since I''m doing the list as a newsgroup thru them, and get the email challenge, so I can post further replies and questions of my own...) -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html