GMIRROR(8) | MidnightBSD System Manager's Manual | GMIRROR(8) |
gmirror
— control
utility for mirrored devices
gmirror |
label [-Fhnv ]
[-b balance]
[-s slice]
name prov ... |
gmirror |
clear [-v ]
prov ... |
gmirror |
create [-Fnv ]
[-b balance]
[-s slice]
name prov ... |
gmirror |
configure [-adfFhnv ]
[-b balance]
[-s slice]
name |
gmirror |
configure [-v ]
-p priority
name prov |
gmirror |
rebuild [-v ]
name prov ... |
gmirror |
resize [-v ]
[-s size]
name |
gmirror |
insert [-hiv ]
[-p priority]
name prov ... |
gmirror |
remove [-v ]
name prov ... |
gmirror |
activate [-v ]
name prov ... |
gmirror |
deactivate [-v ]
name prov ... |
gmirror |
destroy [-fv ]
name ... |
gmirror |
forget [-v ]
name ... |
gmirror |
stop [-fv ]
name ... |
gmirror |
dump prov ... |
gmirror |
list |
gmirror |
status |
gmirror |
load |
gmirror |
unload |
The gmirror
utility is used for mirror
(RAID1) configurations. After a mirror's creation, all components are
detected and configured automatically. All operations like failure
detection, stale component detection, rebuild of stale components, etc. are
also done automatically. The gmirror
utility uses
on-disk metadata (stored in the provider's last sector) to store all needed
information. Since the last sector is used for this purpose, it is possible
to place a root file system on a mirror.
The first argument to gmirror
indicates an
action to be performed:
label
prefer
balance algorithm and is also used as a
master component when resynchronization is needed, e.g. after a power
failure when the device was open for writing.
Additional options include:
-b
balanceload
prefer
round-robin
split
-F
-h
-n
-s
slicesplit
balance algorithm and an
I/O READ request is bigger than or equal to this value, the I/O
request will be split into N pieces, where N is the number of active
components. Defaults to 4096 bytes.clear
create
label
, but creates mirror without
storing on-disk metadata in last sector. This special "manual"
operation mode assumes some external control to manage mirror detection
after reboot, device hot-plug and other external events.configure
Additional options include:
-a
-b
balance-d
-f
-F
-h
-n
-p
priority-s
slicesplit
balance
algorithm.rebuild
resize
Additional options include:
-s
sizeinsert
Additional options include:
remove
activate
deactivate
destroy
Additional options include:
-f
forget
remove
command from being used to remove it.stop
Additional options include:
-f
dump
list
status
load
unload
Additional options include:
-v
Exit status is 0 on success, and 1 if the command fails.
Use 3 disks to setup a mirror. Choose split balance algorithm, split only requests which are bigger than or equal to 2kB. Create file system, mount it, then unmount it and stop device:
gmirror label -v -b split -s 2048 data da0 da1 da2 newfs /dev/mirror/data mount /dev/mirror/data /mnt ... umount /mnt gmirror stop data gmirror unload
Create a mirror on disk with valid data (note that the last sector of the disk will be overwritten). Add another disk to this mirror, so it will be synchronized with existing disk:
gmirror label -v -b round-robin data da0 gmirror insert data da1
Create a mirror, but do not use automatic synchronization feature. Add another disk and rebuild it:
gmirror label -v -n -b load data da0 da1 gmirror insert data da2 gmirror rebuild data da2
One disk failed. Replace it with a brand new one:
gmirror forget data gmirror insert data da1
Create a mirror, deactivate one component, do the backup and connect it again. It will not be resynchronized, if there is no need to do so (there were no writes in the meantime):
gmirror label data da0 da1 gmirror deactivate data da1 dd if=/dev/da1 of=/backup/data.img bs=1m gmirror activate data da1
The following sysctl(8) variables can be used to configure behavior for all mirrors.
Doing kernel dumps to gmirror
providers is
possible, but some conditions have to be met. First of all, a kernel dump
will go only to one component and gmirror
always
chooses the component with the highest priority. Reading a dump from the
mirror on boot will only work if the prefer
balance
algorithm is used (that way gmirror
will read only
from the component with the highest priority). If you use a different
balance algorithm, you should add:
gmirror configure -b prefer data
to the /etc/rc.early script and:
gmirror configure -b round-robin data
to the /etc/rc.local script. The decision which component to choose for dumping is made when dumpon(8) is called. If on the next boot a component with a higher priority will be available, the prefer algorithm will choose to read from it and savecore(8) will find nothing. If on the next boot a component with the highest priority will be synchronized, the prefer balance algorithm will read from the next one, thus will find nothing there.
geom(4), dumpon(8), geom(8), gvinum(8), mount(8), newfs(8), savecore(8), sysctl(8), umount(8)
The gmirror
utility appeared in
FreeBSD 5.3.
Pawel Jakub Dawidek <pjd@FreeBSD.org>
There should be a way to change a component's priority inside a running mirror.
There should be a section with an implementation description.
November 30, 2017 | midnightbsd-3.1 |