btrfs / btrfs-todo

An issues only repo to organize our TODO items
21 stars 2 forks source link

manuelly splitt metadata from other data #50

Open Tuxist opened 1 year ago

Tuxist commented 1 year ago

when i use: mkfs.btrfs -mraid1 /dev/sd[a,b] -dsingle /dev/sdc

why btrfs writes metadata on dev sdc that makes no sense.

i my case i would use ssd for metadata and a hdd for data.

after some questions in irc i have heard btrfs don't support but the tool gives no warning.

why i can change profiles seperatly between meta and data but not select the devices they have to use. so i think is a nonsense feature.

kakra commented 1 year ago

There's a patch set for that feature. Because those patches are difficult to find and track, I collected them here: https://github.com/kakra/linux/pull/26

kakra commented 1 year ago

Also, I think this is already discussed in https://github.com/btrfs/btrfs-todo/issues/19

Zygo commented 1 year ago

A line could be added to the doc to clarify that there is no ordering between options and devices, so they have the same meaning in any order. Note that this is already stated in the synopsis:

mkfs.btrfs [options] <device> [<device>...]

Unfortunately that can't be strictly enforced as it would break any existing script that puts an option after a device name on the command line. There could be at most a warning message indicating this ordering of options is deprecated.

The synopsis for a mkfs.btrfs that had ordered device options would look like this instead:

mkfs.btrfs [global-options] [device-options] <device> [[device-options] <device>...]

The current behavior is that this:

mkfs.btrfs -mraid1 /dev/sda1 /dev/sdb1 -dsingle /dev/sdc1

is exactly identical to any of:

mkfs.btrfs -dsingle -mraid1 /dev/sda1 /dev/sdb1 /dev/sdc1
mkfs.btrfs -mraid1 -dsingle /dev/sda1 /dev/sdb1 /dev/sdc1
mkfs.btrfs /dev/sda1 /dev/sdb1 /dev/sdc1 -dsingle -mraid1 

-d and -m are global options that affect the first block groups created on the filesystem. All listed devices are used to create the filesystem using those profiles.

To clarify the proposed change in #19, to maintain compatibility, -d and -m should remain global mkfs.btrfs options, and new options should be introduced that explicitly introduce (and when present, enforce) ordered behavior:

# Permitted: -d and -m appear before ordered options --metadata-preferred and --data-only
mkfs.btrfs -dsingle -mraid1 --metadata-preferred /dev/sda1 /dev/sdb1 --data-only /dev/sdc1
# (sda1 and sdb1 are metadata-preferred, sdc1 is data-only)

# Rejected: -d appears after a device name and an ordered option was used
mkfs.btrfs -mraid1 --metadata-preferred /dev/sda1 /dev/sdb1 -dsingle --data-only /dev/sdc1

# Permitted:  -d and -m appear after a device name, but no ordered option used
mkfs.btrfs -mraid1 /dev/sda1 /dev/sdb1 -dsingle /dev/sdc1
# (a warning might be printed on stderr)
kakra commented 1 year ago

To clarify the proposed change in #19, to maintain compatibility, -d and -m should remain global mkfs.btrfs options, and new options should be introduced that explicitly introduce (and when present, enforce) ordered behavior:

This is a cool idea to pre-fill the preference hint on creation. I like that.