Whamcloud - gitweb
LU-8055 ldev: Add %H and %b to command sub
[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 "-F, --filesys NAME"
37 Print labels for file system NAME.
38 .TP
39 .I "-s, --sanity"
40 Sanity check config on this node.
41 If any expected local or foreign devices are not present, print an error.
42 If devices do not contain the expected labels, print an error.
43 .TP
44 .I "-d, --device LABEL"
45 Print storage device of label.
46 .TP
47 .I "-j, --journal LABEL"
48 Print journal device corresponding to label if defined.
49 .TP
50 .I "-r, --raidtab LABEL"
51 Print Linux software raid configuration file or ZFS cache file associated with
52 LABEL, if any.  Using non-default names for these files may help prevent arrays
53 from being automatically started by the system.  This is important in failover
54 configurations where the timing of device initialization must be strictly
55 controlled.
56 .TP
57 .I "-t, --type LABEL"
58 Print device type of LABEL, i.e. "zfs" or "md".
59 .TP
60 .I "-z, --zpool LABEL"
61 Print zpool containing LABEL.
62 .TP
63 .I "CMD [ARGS...]"
64 Run one instance of \fICMD [ARGS]\fR for each label in parallel.
65 Only the local labels are used by default, but foreign, all, or file system
66 labels may be selected by adding the \fI--foreign\fR, \fI--all\fR, or
67 \fI--filesys\fR options.
68 The following substitutions are made:
69 %f=fsname, %d=device, %j=journal, %i=index, %I=hex-index, %t=type, %l=label,
70 %n=nid, %N=failnid, %m=mgsnid, %H=hostname, %b=backing-fs.  On failure of
71 any child processes, \fBldev\fR will return a non-zero exit code.
72 .LP
73 It is an error if %n, %N, or %m is used in a command and /etc/nids does not
74 contain appropriate host to NID mappings.
75 .SH EXAMPLES
76 To run a preen check on all devices in a cluster in parallel:
77 .IP
78 .nf
79 pdsh -S -g ost ldev fsck.ldiskfs -p %d
80 .fi
81 .LP
82 To re-format an entire file system:
83 .IP
84 .nf
85 #!/bin/bash -xe
86 export FANOUT=64
87
88 # MDTs
89 pdsh -S -g mds service lustre stop
90 pdsh -S -g mds ldev "yes \\| mkfs.ldiskfs -q -b4096 \\
91          -Ojournal_dev %j"
92 pdsh -S -g mds ldev dd if=/dev/zero of=%d count=8
93 pdsh -S -g mds ldev mkfs.lustre --mdt --mgs --fsname=%f \\
94          --index=%i --mkfsoptions=-Jdevice=%j \\
95          --mkfsoptions=-i2048 \\
96          --mountfsoptions=errors=panic,iopen_nopriv,user_xattr,\\
97                           maxdirsize=20000000 %d
98 pdsh -S -g mds ldev tune.ldiskfs -i0 -m0 -c0 %d
99
100 # OSTs
101 mgs=172.16.2.200@tcp0
102 pdsh -S -g ost service heartbeat stop
103 pdsh -S -g ost service lustre stop
104 pdsh -S -g ost ldev dd if=/dev/zero of=%d count=8
105 pdsh -S -g ost ldev mkfs.lustre --ost --mgsnode=$mgs --fsname=%f \\
106          --index=%i --param=lov.stripecount=2 --failnode=%N \\
107          --mountfsoptions=errors=panic,extents,mballoc %d
108 pdsh -S -g ost ldev tune.ldiskfs -epanic -i0 -m0 -c0 %d
109 .fi
110 .SH FILES
111 /etc/ldev.conf
112 .br
113 /etc/nids
114 .SH "SEE ALSO"
115 .BR ldev.conf (5)
116 .BR nids (5)