mfsbdev(8)

NAME
mfsbdev - MooseFS block device daemon/management tool

SYNOPSIS
mfsbdev start [-H masterhost] [-P masterport] [-B masterbind] [-S masterpath] [-p masterpassword | -x passwordfile] [-l linksocket] [-i init_mappings_file] [-o options]

mfsbdev stop [-l linksocket]

mfsbdev map [-l linksocket] -f mfsfile [-d nbddevice] [-n linkname] [-s bdevsize] [-b blocksize | -5 | -1 | -2 | -4] [-r] [-i]

mfsbdev unmap [-l linksocket] ( -f mfsfile | -d nbddevice | -n linkname )

mfsbdev list [-l linksocket] [-t m|u|i]

mfsbdev resize [-l linksocket] ( -f mfsfile | -d nbddevice | -n linkname ) [-s bdevsize]

DESCRIPTION
This tool is used to manage block devices. This tool works in Linux ONLY. Kernel module nbd must be loaded for this tool to work properly.

  COMMANDS

start - starts the daemon; the daemon only listens on a socket at this point; all the other commands use the socket to communicate with the daemon; if no socket is specified via -l option, the default is used: /dev/mfs/nbdsock

stop - stops the daemon

map - maps a file on mfs to be used as a block device

unmap - removes a mapping

list - lists current mappings

resize - changes the size of a block device (requires kernel version 4.18 or higher)

OPTIONS

-H - master host; default is 'mfsmaster'

-P - master port; default is '9421'

-S - master path (subfolder in MFS that will be used as a root for all block device mappings); default is '/'

-p - master password; mutually exclusive with -x option; if neither -p nor -x are supplied, the tool tries to connect without a password

-x - path to a file containing master password; mutually exclusive with -p option; if neither -p nor -x are supplied, the tool tries to connect without a password

-l - path to communication socket; default is /dev/mfs/nbdsock

-f - path to mfs file used to map block device;

-d - path to network block device ('/dev/nbdX'); by default (if this parameter is not supplied) first available device is used with the map command

-n - name of symbolic link created in '/dev/mfs', pointing at the network block device created by the map command; default is a combination of master hostname, port and mfs file name

-s - size of the block device, both SI and IEC suffixes can be used; default is the size of the file the block device is mapped to

-b - block size in bytes

-5 - use block size 512 bytes (eq to -b 512)

-1 - use block size 1024 bytes (eq to -b 1024)

-2 - use block size 2048 bytes (eq to -b 2048)

-4 - use block size 4096 bytes (eq to -b 4096)

-r - maps block device as readonly (allows multiple mappings of the same file)

-i (map) - ignore locks; one file may be mapped to more than one block device, each map operation will try to obtain the appropriate lock (shared for ro, exclusive for rw) but will succed even if the lock is not obtained

-t - forces the list command to display information in a format ready to use with map (m parameter) or unmap (u parameter) command or with MooseFS mfsbdev.cfg file format (i parameter)

-i (start) - use config file supplied in parameter to start initial block devices; for formatting of the config see mfsbdev.cfg(5)

-o - additional params, mfsmount-style, many params can be defined, separated by comma:

mfswritecachesize=N
    specify write cache size in MiB (in range: 16..2048 - default: 128)

mfsreadaheadsize=N
    define size of all read ahead buffers in MiB (in range: 16..2048 - default: 128)

mfsreadaheadleng=N
    define amount of bytes to be additionally read (in range: 128KiB..2MiB - default: 2097152 = 2MiB)

mfsreadaheadtrigger=N
    define amount of bytes read sequentially that turns on read ahead (default: 20971520)

mfserroronlostchunk
    when all known chunkservers are connected to the master and the required chunk is missing then immediately finish I/O and return an error

mfserroronnospace
    when all known chunkservers are connected to the master and there is no free space then immediately finish I/O and return an error

mfsioretries=N
    specify number of retries before I/O error is returned (default: 30)

mfstimeout=N
    define maximum timeout in seconds before I/O error is returned (default: 0 - which means no timeout)

mfslogretry=N
    define minimal retry counter on which system will start log I/O messages (default: 5)

mfsmaster=HOST
    connect with MooseFS master on HOST (default is mfsmaster) - equivalent to -H

mfsport=PORT
    connect with MooseFS master on PORT (default is 9421) - equivalent to -P

mfsbind=IP
    local address to use for connecting with master instead of default one - equivalent to -B

mfssubfolder=PATH
    mount specified MooseFS directory (default is /, i.e. whole filesystem) - equivalent to -S

mfspassword=PASSWORD
    authenticate to MooseFS master with PASSWORD

mfspreflabels=LABELEXPR
    specify preferred labels for choosing chunkservers during I/O

mfsnbdtimeout=N
    define maximum timeout in seconds before kernel gives up (default: 1800)

FILES

mfsbdev.cfg
    configuration file for MooseFS block device daemon; refer to mfsbdev.cfg(5) manual for details

EXAMPLES

mfsbdev start - start nbd daemon with default options (masterhost = mfsmaster, masterport = 9421, linksocket = /dev/mfs/nbdsock, authentication without password)

mfsbdev start -H mfsmaster.my.domain -P 9521 -x /etc/mfs/mastersecret - start nbd daemon that will connect to master mfsmaster.my.domain on port 9521 using password read from file /etc/mfs/mastersecret

mfsbdev stop -l /tmp/mynbdinstance - stop nbd daemon using for communication unix socket /tmp/mynbdinstance

mfsbdev map -f devices/mybdev1.bin -s 2Ti -n mytestvm - add mapping to daemon using for communication default socket (/dev/mfs/nbdsock). Device will be assigned automatically, file devices/mybdev1.bin will be mapped to this device, link '/dev/mfs/mytestvm' to this device will be created and block device will have size of 2TiB.

mfsbdev unmap -n mytestvm - remove mapping that has link named mytestvm (uses link /dev/mfs/mytestvm).

REPORTING BUGS
Report bugs to <bugs@moosefs.com>.

COPYRIGHT
Copyright (C) 2025 Jakub Kruszona-Zawadzki, Saglabs SA This file is part of MooseFS. MooseFS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 (only). MooseFS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with MooseFS; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA or visit http://www.gnu.org/licenses/gpl-2.0.html

SEE ALSO
mfsmount(8), mfsbdev.cfg(5)