summaryrefslogtreecommitdiffstats
path: root/sbin/ccdconfig
diff options
context:
space:
mode:
authorcracauer <cracauer@FreeBSD.org>2006-04-13 20:35:31 +0000
committercracauer <cracauer@FreeBSD.org>2006-04-13 20:35:31 +0000
commit452517900b740c1fd397a45dd60e21139e4ff858 (patch)
treee57019f9c8880c0c23b44e552f1fd6f71f1890a3 /sbin/ccdconfig
parent65aeb543f38c35372f717f654ab9ddab09e77d7b (diff)
downloadFreeBSD-src-452517900b740c1fd397a45dd60e21139e4ff858.zip
FreeBSD-src-452517900b740c1fd397a45dd60e21139e4ff858.tar.gz
Make CCD be able to read and write Linux software raids.
Supported for raid-0 with <n> disks, raid-1 with 2 disks. Manpages have examples, warnings etc. Test scripts on http://www.cons.org/cracauer/ccdconfig-linux/ Reviewed by: alfred
Diffstat (limited to 'sbin/ccdconfig')
-rw-r--r--sbin/ccdconfig/ccdconfig.816
-rw-r--r--sbin/ccdconfig/ccdconfig.c10
2 files changed, 26 insertions, 0 deletions
diff --git a/sbin/ccdconfig/ccdconfig.8 b/sbin/ccdconfig/ccdconfig.8
index 4ba08be..bbd7428 100644
--- a/sbin/ccdconfig/ccdconfig.8
+++ b/sbin/ccdconfig/ccdconfig.8
@@ -104,6 +104,8 @@ The flags are as follows:
.Bd -literal -offset indent
CCDF_UNIFORM 0x02 Use uniform interleave
CCDF_MIRROR 0x04 Support mirroring
+CCDF_NO_OFFSET 0x08 Do not use an offset
+CCDF_LINUX 0x0A Linux md(4) compatibility
.Ed
.Pp
The format in the
@@ -127,6 +129,10 @@ The component devices need to name partitions of type
.Dq 4.2BSD
as shown by
.Xr disklabel 8 ) .
+.Pp
+If you want to use the Linux md(4) compatibility mode, please be sure
+to read the notes in
+.Xr ccd 4 .
.Sh FILES
.Bl -tag -width /etc/ccd.conf -compact
.It Pa /etc/ccd.conf
@@ -159,6 +165,16 @@ and assigned to ccd0.
# ccdconfig ccd0 128 CCDF_MIRROR /dev/da8s2 /dev/da9s3
.Ed
.Pp
+The following are matching commands in Linux and FreeBSD to create a
+raid-0 in Linux and read it from FreeBSD.
+.Bd -literal
+# Create a raid-0 on Linux:
+mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
+ /dev/hda1 /dev/hdb1
+# Make the raid-0 just created available on FreeBSD:
+ccdconfig -c /dev/ccd0 32 linux /dev/ad0s1 /dev/ad0s2
+.Ed
+.Pp
When you create a new ccd disk you generally want to
.Xr fdisk 8
and
diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c
index 0c584ff..928aba5 100644
--- a/sbin/ccdconfig/ccdconfig.c
+++ b/sbin/ccdconfig/ccdconfig.c
@@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$");
#define CCDF_UNIFORM 0x02 /* use LCCD of sizes for uniform interleave */
#define CCDF_MIRROR 0x04 /* use mirroring */
+#define CCDF_NO_OFFSET 0x08 /* do not leave space in front */
+#define CCDF_LINUX 0x10 /* use Linux compatibility mode */
#include "pathnames.h"
@@ -65,6 +67,10 @@ struct flagval {
{ "uniform", CCDF_UNIFORM },
{ "CCDF_MIRROR", CCDF_MIRROR },
{ "mirror", CCDF_MIRROR },
+ { "CCDF_NO_OFFSET", CCDF_NO_OFFSET },
+ { "no_offset", CCDF_NO_OFFSET },
+ { "CCDF_LINUX", CCDF_LINUX },
+ { "linux", CCDF_LINUX },
{ "none", 0 },
{ NULL, 0 },
};
@@ -245,6 +251,10 @@ do_single(int argc, char **argv, int action)
gctl_ro_param(grq, "uniform", -1, "");
if (flags & CCDF_MIRROR)
gctl_ro_param(grq, "mirror", -1, "");
+ if (flags & CCDF_NO_OFFSET)
+ gctl_ro_param(grq, "no_offset", -1, "");
+ if (flags & CCDF_LINUX)
+ gctl_ro_param(grq, "linux", -1, "");
gctl_ro_param(grq, "nprovider", sizeof(argc), &argc);
for (i = 0; i < argc; i++) {
sprintf(buf1, "provider%d", i);
OpenPOWER on IntegriCloud