Whamcloud - gitweb
LU-7060 ldev: Added MGS NID substitution to ldev
[fs/lustre-release.git] / lustre / doc / ldev.8
1 .TH ldev 8 Lustre ldev ldev
2 .SH NAME
3 ldev \- lustre device utility
4 .SH SYNOPSIS
5 .B "ldev [OPTIONS]"
6 .br
7 .SH DESCRIPTION
8 .B ldev
9 can be used to query information about lustre devices configured in
10 /etc/ldev.conf.  It is used by the lustre init script.
11 .SH OPTIONS
12 .B ldev
13 accepts the following options:
14 .TP
15 .I "-h, --help"
16 Display help message.
17 .TP
18 .I "-c, --config FILE"
19 Set path to config file.
20 .TP
21 .I "-H, --hostname NAME"
22 Use NAME instead of local hostname for queries.
23 .TP
24 .I "-p, --partner"
25 Print hostname of failover partner.
26 .TP
27 .I "-l, --local"
28 Print labels for local devices.
29 .TP
30 .I "-f, --foreign"
31 Print labels for foreign devices.
32 .TP
33 .I "-a, --all"
34 Print labels for local and foreign devices.
35 .TP
36 .I "-s, --sanity"
37 Sanity check config on this node.
38 If any expected local or foreign devices are not present, print an error.
39 If devices do not contain the expected labels, print an error.
40 .TP
41 .I "-d, --device LABEL"
42 Print storage device of label.
43 .TP
44 .I "-j, --journal LABEL"
45 Print journal device corresponding to label if defined.
46 .TP
47 .I "-r, --raidtab LABEL"
48 Print Linux software raid configuration file or ZFS cache file associated with
49 LABEL, if any.  Using non-default names for these files may help prevent arrays
50 from being automatically started by the system.  This is important in failover
51 configurations where the timing of device initialization must be strictly
52 controlled.
53 .TP
54 .I "-t, --type LABEL"
55 Print device type of LABEL, i.e. "zfs" or "md".
56 .TP
57 .I "-z, --zpool LABEL"
58 Print zpool containing LABEL.
59 .TP
60 .I "CMD [ARGS...]"
61 Run one instance of \fICMD [ARGS]\fR for each label in parallel.
62 Only the local labels are used by default, but foreign or all labels
63 may be selected by adding the \fI--foreign\fR or \fI--all\fR options.
64 The following substitutions are made:
65 %f=fsname, %d=device, %j=journal, %i=index, %I=hex-index, %t=type, %l=label,
66 %n=nid, %N=failnid, %m=mgsnid.  On failure of any child processes, \fBldev\fR will
67 return a non-zero exit code.
68 .LP
69 It is an error if %n, %N, or %m is used in a command and /etc/nids does not
70 contain appropriate host to NID mappings.
71 .SH EXAMPLES
72 To run a preen check on all devices in a cluster in parallel:
73 .IP
74 .nf
75 pdsh -S -g ost ldev fsck.ldiskfs -p %d
76 .fi
77 .LP
78 To re-format an entire file system:
79 .IP
80 .nf
81 #!/bin/bash -xe
82 export FANOUT=64
83
84 # MDTs
85 pdsh -S -g mds service lustre stop
86 pdsh -S -g mds ldev "yes \\| mkfs.ldiskfs -q -b4096 \\
87          -Ojournal_dev %j"
88 pdsh -S -g mds ldev dd if=/dev/zero of=%d count=8
89 pdsh -S -g mds ldev mkfs.lustre --mdt --mgs --fsname=%f \\
90          --index=%i --mkfsoptions=-Jdevice=%j \\
91          --mkfsoptions=-i2048 \\
92          --mountfsoptions=errors=panic,iopen_nopriv,user_xattr,\\
93                           maxdirsize=20000000 %d
94 pdsh -S -g mds ldev tune.ldiskfs -i0 -m0 -c0 %d
95
96 # OSTs
97 mgs=172.16.2.200@tcp0
98 pdsh -S -g ost service heartbeat stop
99 pdsh -S -g ost service lustre stop
100 pdsh -S -g ost ldev dd if=/dev/zero of=%d count=8
101 pdsh -S -g ost ldev mkfs.lustre --ost --mgsnode=$mgs --fsname=%f \\
102          --index=%i --param=lov.stripecount=2 --failnode=%N \\
103          --mountfsoptions=errors=panic,extents,mballoc %d
104 pdsh -S -g ost ldev tune.ldiskfs -epanic -i0 -m0 -c0 %d
105 .fi
106 .SH FILES
107 /etc/ldev.conf
108 .br
109 /etc/nids
110 .SH "SEE ALSO"
111 .BR ldev.conf (5)
112 .BR nids (5)