* Single drive volume + second drive -> RAID1?
@ 2012-01-23 8:36 James
2012-01-23 8:52 ` James
0 siblings, 1 reply; 5+ messages in thread
From: James @ 2012-01-23 8:36 UTC (permalink / raw)
To: linux-btrfs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Single drive volume + second drive -> RAID1?
2012-01-23 8:36 Single drive volume + second drive -> RAID1? James
@ 2012-01-23 8:52 ` James
2012-01-23 9:25 ` Hugo Mills
0 siblings, 1 reply; 5+ messages in thread
From: James @ 2012-01-23 8:52 UTC (permalink / raw)
To: linux-btrfs
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 wit=
h
> 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:
> =A01. mkfs.btrfs on a single drive but tell it to use RAID1
> =A02. copy data on
> =A03. once the second drive for the RAID1 was available, add it to th=
e
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Single drive volume + second drive -> RAID1?
2012-01-23 8:52 ` James
@ 2012-01-23 9:25 ` Hugo Mills
2012-01-23 21:17 ` James
0 siblings, 1 reply; 5+ messages in thread
From: Hugo Mills @ 2012-01-23 9:25 UTC (permalink / raw)
To: James; +Cc: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1905 bytes --]
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!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Single drive volume + second drive -> RAID1?
2012-01-23 9:25 ` Hugo Mills
@ 2012-01-23 21:17 ` James
2012-01-26 10:27 ` Duncan
0 siblings, 1 reply; 5+ messages in thread
From: James @ 2012-01-23 21:17 UTC (permalink / raw)
To: Hugo Mills, James, linux-btrfs
On Mon, Jan 23, 2012 at 1:25 AM, Hugo Mills <hugo@carfax.org.uk> wrote:
> =A0 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.
> =A0 Then you can restore from your backups. You do have backups, righ=
t?
> (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.
> =A0 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Single drive volume + second drive -> RAID1?
2012-01-23 21:17 ` James
@ 2012-01-26 10:27 ` Duncan
0 siblings, 0 replies; 5+ messages in thread
From: Duncan @ 2012-01-26 10:27 UTC (permalink / raw)
To: linux-btrfs
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> wrot=
e:
>> =C2=A0 Why not just create the filesystem as RAID-1 in the first pla=
ce?
>>
>> # mkfs.btrfs -d raid1 -m raid1 /dev/sda1 /dev/sdb1
>=20
> As I said, I've only got two working drives large enough at present.
>=20
>> =C2=A0 Then you can restore from your backups. You do have backups, =
right?
>> (Remember, this is a filesystem still marked as "experimental").
>=20
> Yes, I know. :) I just have remote backups,
=46irst post to the list, as I'm just planning my switch to btrfs... du=
e to=20
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=
=20
interest there that should be very useful to you right now. Here's the=
=20
link altho the below actually has a bit more detail than the wiki (but=20
the wiki obviously has other useful information not apropos to this=20
situation):
https://btrfs.wiki.kernel.org/articles/u/s/e/UseCases_8bd8.html
=46irst:
Creating a btrfs-raid-1 in "degraded mode", that is, with a missing=20
drive, to be added later: Apparently it's not possible to do that=20
directly yet, but there's a trick to work around the issue that sounds=20
like just what you need ATM.
The idea is to create a "small" (the example in the wiki uses 4 GB, I=20
guess I'm getting old as that doesn't seem all that small to me!!) "fak=
e"=20
device using loopback to serve as the "missing" device, create the=20
filesystem specifying raid-1 for both data and metadata (-m raid1 -d=20
raid1) giving mkfs both the real and loopback devices to work with, the=
n=20
delete the loopback device and remove the file backing it, so that all=20
that's left is the single "real" device:
dd if=3D/dev/zero of=3D/tmp/empty bs=3D1 count=3D0 seek=3D4G
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=20
loopback device file on a USB thumbdrive if necessary...
You should then be able to copy everything over to the new btrfs=20
operating in degraded raid-1. After testing to ensure it's there and=20
usable (bootable if that's your intention), you can blank the old drive=
=2E =20
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=20
you had raid-1:
(kernel 2.6.37) Simply creating the filesystem with too few devices wil=
l=20
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 ha=
s=20
now been fixed.
NB: As I mentioned above I'm only researching btrfs for my systems now=
,=20
so obviously have no clue how the above suggestions work in practice. =20
They're simply off the wiki.
(Now to send this via gmane.org since I'm doing the list as a newsgroup=
=20
thru them, and get the email challenge, so I can post further replies a=
nd=20
questions of my own...)
--=20
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-26 10:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 8:36 Single drive volume + second drive -> RAID1? James
2012-01-23 8:52 ` James
2012-01-23 9:25 ` Hugo Mills
2012-01-23 21:17 ` James
2012-01-26 10:27 ` Duncan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).