From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: Single drive volume + second drive -> RAID1?
Date: Thu, 26 Jan 2012 10:27:33 +0000 (UTC) [thread overview]
Message-ID: <pan.2012.01.26.10.27.33@cox.net> (raw)
In-Reply-To: CAEPoJ-2Sa2wiJf2osak5vPMYg=FtR=2f0M7vKK6cdopqB=aLwA@mail.gmail.com
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
prev parent reply other threads:[~2012-01-26 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pan.2012.01.26.10.27.33@cox.net \
--to=1i5t5.duncan@cox.net \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).