From: Hugo Mills <hugo@carfax.org.uk>
To: Pierre Couderc <pierre@couderc.eu>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: Which device is missing ?
Date: Mon, 8 Oct 2018 21:21:47 +0000 [thread overview]
Message-ID: <20181008212147.GA9538@carfax.org.uk> (raw)
In-Reply-To: <b93e52ee-7bc5-db85-b634-d8aa5ed80ced@couderc.eu>
[-- Attachment #1: Type: text/plain, Size: 4745 bytes --]
On Mon, Oct 08, 2018 at 11:01:35PM +0200, Pierre Couderc wrote:
> On 10/08/2018 06:14 PM, Hugo Mills wrote:
> >On Mon, Oct 08, 2018 at 04:10:55PM +0000, Hugo Mills wrote:
> >>On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote:
> >>>I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar).
> >>>
> >>>But I have stranges status or errors about "missing devices" and I
> >>>do not understand the current situation :
> >>>
> >>>
> >>>root@server:~# btrfs fi show
> >>>Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb
> >>> Total devices 1 FS bytes used 190.91GiB
> >>> devid 1 size 1.82TiB used 196.02GiB path /dev/sda2
> >>>
> >>>warning, device 1 is missing
> >>>Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa
> >>> Total devices 2 FS bytes used 116.18GiB
> >>> devid 2 size 1.82TiB used 118.03GiB path /dev/sdb
> >>> *** Some devices missing
> >> This looks like you've created a RAID-1 array with /dev/sda2 and
> >>/dev/sdb, and then run mkfs.btrfs again on /dev/sda2, overwriting the
> >>original [part of a] filesystem on /dev/sda2, and replacing it with a
> >>wholly different filesystem. Since the new FS on /dev/sda2 (UUID
> >>28c2...) doesn't have the same UUID as the original FS (UUID 2d45...),
> >>and the original FS was made of two devices, btrfs fi show is telling
> >>you that there's some devices missing -- /dev/sda2 is no longer part
> >>of that FS, and is therefore a missing device.
> >>
> >> I note that you've got data on both filesystems, so they must both
> >>have been mounted somewhere and had stuff put on them.
> >>
> >> I recommend doing something like this:
> >>
> >># mkfs /media/btrfs/myraid1 /media/btrfs/tmp
> >># mount /dev/sdb /media/btrfs/myraid1/
> >># mount /dev/sda2 /media/btrfs/tmp/ # mount both filesystems
> >># cp /media/btrfs/tmp/* /media/btrfs/myraid1 # put it where you want it
> >># umount /media/btrfs/tmp/
> >># wipefs /dev/sda2 # destroy the FS on sda2
> >># btrfs replace start 1 /dev/sda2 /media/btrfs/myraid1/
> >>
> >> This will copy all the data from the filesystem on /dev/sda2 into
> >>the filesystem on /dev/sdb, destroy the FS on sda2, and then use sda2
> >>as the second device for the main FS.
> >>
> >>*WARNING!*
> >>
> >> Note that, since the main FS is missing a device, it will probably
> >>need to be mounted in degraded mode (-o degraded), and that on kernels
> >>earlier than (IIRC) 4.14, this can only be done *once* without the FS
> >>becoming more or less permanently read-only. On recent kernels, it
> >>_should_ be OK.
> >>
> >>*WARNING ENDS*
> > Oh, and for the record, to make a RAID-1 filesystem from scratch,
> >you simply need this:
> >
> ># mkfs.btrfs -m raid1 -d raid1 /dev/sda2 /dev/sdb
> >
> > You do not need to run mkfs.btrfs on each device separately.
> >
> > Hugo.
> Thnk you very much. I understand a bit better. I think that I have
> nothing of interest on /dev/sdb and that its contents is the result
> of previous trials.
> And that my system is on /dev/dsda2 as :
>
> root@server:~# df -h
> Filesystem Size Used Avail Use% Mounted on
> udev 3.9G 0 3.9G 0% /dev
> tmpfs 787M 8.8M 778M 2% /run
> /dev/sda2 1.9T 193G 1.7T 11% /
> tmpfs 3.9G 0 3.9G 0% /dev/shm
> tmpfs 5.0M 0 5.0M 0% /run/lock
> tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
> /dev/sda1 511M 5.7M 506M 2% /boot/efi
> tmpfs 100K 0 100K 0% /var/lib/lxd/shmounts
> tmpfs 100K 0 100K 0% /var/lib/lxd/devlxd
> root@server:~#
>
> Is it exact ?
Yes, it looks like you're running / from the FS on /dev/sda2.
> If yes, I suppose I should wipe data on /dev/sdb, then build the
> RAID by expanding /dev/sda2.
Correct.
I would recommend putting a partition table on /dev/sdb, because it
doesn't take up much space, and it's always easier to have one already
there when you need it (and there's a few things that can get confused
if there isn't a partition table).
> So I should :
>
> wipefs /dev/sdb
> btrfs device add /dev/sdb /
> btrfs balance start -v -mconvert=raid1 -dconvert=raid1 /
> Does it sound correct ? (my kernel is boot/vmlinuz-4.18.0-1-amd64)
Yes, exactly.
Hugo.
--
Hugo Mills | Yes, this is an example of something that becomes
hugo@... carfax.org.uk | less explosive as a one-to-one cocrystal with TNT.
http://carfax.org.uk/ | (Hexanitrohexaazaisowurtzitane)
PGP: E2AB1DE4 | Derek Lowe
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2018-10-08 21:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 13:49 Which device is missing ? Pierre Couderc
2018-10-08 16:10 ` Hugo Mills
2018-10-08 16:14 ` Hugo Mills
2018-10-08 21:01 ` Pierre Couderc
2018-10-08 21:21 ` Hugo Mills [this message]
2018-10-08 21:37 ` Pierre Couderc
2018-10-09 0:08 ` merge status of per-chunk degradable check [was Re: Which device is missing ?] Nicholas D Steeves
2018-10-09 0:16 ` Hans van Kranenburg
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=20181008212147.GA9538@carfax.org.uk \
--to=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
--cc=pierre@couderc.eu \
/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).