Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Hugo Mills <hugo@carfax.org.uk>
To: John Center <jlcenter15@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: How to convert a directory to a subvolume
Date: Sat, 30 Apr 2022 21:14:58 +0100	[thread overview]
Message-ID: <20220430201458.GG15632@savella.carfax.org.uk> (raw)
In-Reply-To: <87238001-69C5-4FA8-BE83-C35338BC8C81@gmail.com>

On Sat, Apr 30, 2022 at 04:08:59PM -0400, John Center wrote:
> Hi,
> 
> I just installed Ubuntu 22.04 with a btrfs raid1 root filesystem.  I want to convert a directory, like /opt, into a subvolume. I haven’t been having much luck.  /opt is empty right now, so it’s a good candidate for conversion.  Could someone please explain how to do it?  I’ve been at a dozen different websites, & tried different variations of the “btrfs subvolume create” command, but nothing works when I go to mount it.  I think I’m missing something simple, but not sure what it is.

   You can't convert a directory into a subvolume.

   Since the directory in question is empty, just delete it and create
a subvol there instead:

# rmdir /opt
# btrfs sub create /opt

   If there's stuff in there, you need to create the subvolume with a
different name, copy the contents of the directory into it (optionally
with --reflink=always) and then delete the original directory and move
the subvolume into its place.

   Hugo.

-- 
Hugo Mills             | UNIX: British manufacturer of modular shelving units
hugo@... carfax.org.uk |
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

  reply	other threads:[~2022-04-30 20:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30 20:08 How to convert a directory to a subvolume John Center
2022-04-30 20:14 ` Hugo Mills [this message]
2022-05-02  0:02   ` John Center
2022-05-02 13:16     ` Chris Murphy
2022-05-02 15:37       ` John Center
2022-05-02 16:15         ` Chris Murphy
2022-05-02 18:51           ` John Center
2022-05-01  5:05 ` Chris Murphy

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=20220430201458.GG15632@savella.carfax.org.uk \
    --to=hugo@carfax.org.uk \
    --cc=jlcenter15@gmail.com \
    --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