| C H A P T E R 13 |
|
Lustre Operations |
Once you have the Lustre file system up and running, you can use the procedures in this section to perform these basic Lustre administration tasks:
The file system name is limited to 8 characters. We have encoded the file system and target information in the disk label, so you can mount by label. This allows system administrators to move disks around without worrying about issues such as SCSI disk reordering or getting the /dev/device wrong for a shared target. Soon, file system naming will be made as fail-safe as possible. Currently, Linux disk labels are limited to 16 characters. To identify the target within the file system, 8 characters are reserved, leaving 8 characters for the file system name:
<fsname>-MDT0000 or <fsname>-OST0a19
To mount by label, use this command:
$ mount -t lustre -L <file system label> <mount point>
This is an example of mount-by-label:
$ mount -t lustre -L testfs-MDT0000 /mnt/mdt
|
Caution - Mount-by-label should NOT be used in a multi-path environment. |
Although the file system name is internally limited to 8 characters, you can mount the clients at any mount point, so file system users are not subjected to short names. Here is an example:
mount -t lustre uml1@tcp0:/shortfs /mnt/<long-file_system-name>
The startup order of Lustre components depends on whether you have a combined MGS/MDT or these components are separate.
Starting a Lustre server is straightforward and only involves the mount command. Lustre servers can be added to /etc/fstab:
mount -t lustre
The mount command generates output similar to this:
/dev/sda1 on /mnt/test/mdt type lustre (rw) /dev/sda2 on /mnt/test/ost0 type lustre (rw) 192.168.0.21@tcp:/testfs on /mnt/testfs type lustre (rw)
In this example, the MDT, an OST (ost0) and file system (testfs) are mounted.
LABEL=testfs-MDT0000 /mnt/test/mdt lustre defaults,_netdev,noauto 0 0 LABEL=testfs-OST0000 /mnt/test/ost0 lustre defaults,_netdev,noauto 0 0
In general, it is wise to specify noauto and let your high-availability (HA) package manage when to mount the device. If you are not using failover, make sure that networking has been started before mounting a Lustre server. RedHat, SuSE, Debian (and perhaps others) use the _netdev flag to ensure that these disks are mounted after the network is up.
We are mounting by disk label here--the label of a device can be read with e2label. The label of a newly-formatted Lustre server ends in FFFF, meaning that it has yet to be assigned. The assignment takes place when the server is first started, and the disk label is updated.
|
Caution - Do not do this when the client and OSS are on the same node, as memory pressure between the client and OSS can lead to deadlocks. |
|
Caution - Mount-by-label should NOT be used in a multi-path environment. |
To stop a Lustre server, use the umount <mount point> command.
For example, to stop ost0 on mount point /mnt/test, run:
$ umount /mnt/test
Gracefully stopping a server with the umount command preserves the state of the connected clients. The next time the server is started, it waits for clients to reconnect, and then goes through the recovery procedure.
If the force (-f) flag is used, then the server evicts all clients and stops WITHOUT recovery. Upon restart, the server does not wait for recovery. Any currently connected clients receive I/O errors until they reconnect.
| Note - If you are using loopback devices, use the -d flag. This flag cleans up loop devices and can always be safely specified. |
Lustre uses two modes, failout and failover, to handle an OST that has become unreachable because it fails, is taken off the network, is unmounted, etc.
By default, the Lustre file system uses failover mode for OSTs. To specify failout mode instead, run this command:
$ mkfs.lustre --fsname=<fsname> --ost --mgsnode=<MGS node NID> --param="failover.mode=failout" <block device name>
In this example, failout mode is specified for the OSTs on MGS uml1, file system testfs.
$ mkfs.lustre --fsname=testfs --ost --mgsnode=uml1 --param="failover.mode=failout" /dev/sdb
|
Caution - Before running this command, unmount all OSTs that will be affected by the change in the failover/failout mode. |
Lustre includes functionality that notifies Lustre if an external RAID array has degraded performance (resulting in reduced overall file system performance), either because a disk has failed and not been replaced, or because a disk was replaced and is undergoing a rebuild. To avoid a global performance slowdown due to a degraded OST, the MDS can avoid the OST for new object allocation if it is notified of the degraded state.
A parameter for each OST, called degraded, specifies whether the OST is running in degraded mode or not.
To mark the OST as degraded, use:
lctl set_param obdfilter.{OST_name}.degraded=1
To mark that the OST is back in normal operation, use:
lctl set_param obdfilter.{OST_name}.degraded=0
To determine if OSTs are currently in degraded mode, use:
lctl get_param obdfilter.*.degraded
If the OST is remounted due to a reboot or other condition, the flag resets to 0.
It is recommended that this be implemented by an automated script that monitors the status of individual RAID devices.
There may be situations in which you want to run multiple file systems. This is doable, as long as you follow specific naming conventions.
By default, the mkfs.lustre command creates a file system named lustre. To specify a different file system name (limited to 8 characters), run this command:
mkfs.lustre --fsname=<new file system name>
To mount a client on the file system, run:
mount -t lustre mgsnode:/<new fsname> <mountpoint>
For example, to mount a client on file system foo at mount point /mnt/lustre1, run:
mount -t lustre mgsnode:/foo /mnt/lustre1
| Note - If a client(s) will be mounted on several file systems, add the following line to /etc/xattr.conf file to avoid problems when files are moved between the file systems: lustre.* skip |
| Note - The MGS is universal; there is only one MGS per Lustre installation, not per file system. |
| Note - There is only one file system per MDT. Therefore, specify --mdt --mgs on one file system and --mdt --mgsnode=<MGS node NID> on the other file systems. |
A Lustre installation with two file systems (foo and bar) could look like this, where the MGS node is mgsnode@tcp0 and the mount points are /mnt/lustre1 and /mnt/lustre2.
mgsnode# mkfs.lustre --mgs /mnt/lustre1 mdtfoonode# mkfs.lustre --fsname=foo --mdt --mgsnode=mgsnode@tcp0 /mnt/lustre1 ossfoonode# mkfs.lustre --fsname=foo --ost --mgsnode=mgsnode@tcp0 /mnt/lustre1 ossfoonode# mkfs.lustre --fsname=foo --ost --mgsnode=mgsnode@tcp0 /mnt/lustre2 mdtbarnode# mkfs.lustre --fsname=bar --mdt --mgsnode=mgsnode@tcp0 /mnt/lustre1 ossbarnode# mkfs.lustre --fsname=bar --ost --mgsnode=mgsnode@tcp0 /mnt/lustre1 ossbarnode# mkfs.lustre --fsname=bar --ost --mgsnode=mgsnode@tcp0 /mnt/lustre2
To mount a client on file system foo at mount point /mnt/lustre1, run:
mount -t lustre mgsnode@tcp0:/foo /mnt/lustre1
To mount a client on file system bar at mount point /mnt/lustre2, run:
mount -t lustre mgsnode@tcp0:/bar /mnt/lustre2
Several options are available for setting parameters in Lustre:
When the file system is created, parameters can simply be added as a --param option to the mkfs.lustre command. For example:
$ mkfs.lustre --mdt --param="sys.timeout=50" /dev/sda
For more details about creating a file system,see Chapter 10: Configuring Lustre. For more details about mkfs.lustre, see Chapter 36: System Configuration Utilities.
If a server (OSS or MDS) is stopped, parameters can be added using the --param option to the tunefs.lustre command. For example:
$ tunefs.lustre --param="failover.node=192.168.0.13@tcp0" /dev/sda
With tunefs.lustre, parameters are "additive" -- new parameters are specified in addition to old parameters, they do not replace them. To erase all old tunefs.lustre parameters and just use newly-specified parameters, run:
$ tunefs.lustre --erase-params --param=<new parameters>
The tunefs.lustre command can be used to set any parameter settable in a /proc/fs/lustre file and that has its own OBD device, so it can be specified as <obd|fsname>.<obdtype>.<proc_file_name>=<value>. For example:
$ tunefs.lustre --param mdt.group_upcall=NONE /dev/sda1
For more details about tunefs.lustre, see Chapter 36: System Configuration Utilities.
When the file system is running, the lctl command can be used to set parameters (temporary or permanent) and report current parameter values. Temporary parameters are active as long as the server or client is not shut down. Permanent parameters live through server and client reboots.
| Note - The lctl list_param command enables users to list all parameters that can be set. See Listing Parameters. |
For more details about the lctl command, see the examples in the sections below and Chapter 36: System Configuration Utilities.
Use lctl set_param to set temporary parameters on the node where it is run. These parameters map to items in /proc/{fs,sys}/{lnet,lustre}. The lctl set_param command uses this syntax:
lctl set_param [-n] <obdtype>.<obdname>.<proc_file_name>=<value>
# lctl set_param osc.*.max_dirty_mb=1024 osc.myth-OST0000-osc.max_dirty_mb=32 osc.myth-OST0001-osc.max_dirty_mb=32 osc.myth-OST0002-osc.max_dirty_mb=32 osc.myth-OST0003-osc.max_dirty_mb=32 osc.myth-OST0004-osc.max_dirty_mb=32
Use the lctl conf_param command to set permanent parameters. In general, the lctl conf_param command can be used to specify any parameter settable in a /proc/fs/lustre file, with its own OBD device. The lctl conf_param command uses this syntax (same as the mkfs.lustre and tunefs.lustre commands):
<obd|fsname>.<obdtype>.<proc_file_name>=<value>)
Here are a few examples of lctl conf_param commands:
$ mgs> lctl conf_param testfs-MDT0000.sys.timeout=40 $ lctl conf_param testfs-MDT0000.mdt.group_upcall=NONE $ lctl conf_param testfs.llite.max_read_ahead_mb=16 $ lctl conf_param testfs-MDT0000.lov.stripesize=2M $ lctl conf_param testfs-OST0000.osc.max_dirty_mb=29.15 $ lctl conf_param testfs-OST0000.ost.client_cache_seconds=15 $ lctl conf_param testfs.sys.timeout=40
|
Caution - Parameters specified with the lctl conf_param command are set permanently in the file system’s configuration file on the MGS. |
To list Lustre or LNET parameters that are available to set, use the lctl list_param command. For example:
lctl list_param [-FR] <obdtype>.<obdname>
The following arguments are available for the lctl list_param command.
-F Add '/', '@' or '=' for directories, symlinks and writeable files, respectively
-R Recursively lists all parameters under the specified path
$ lctl list_param obdfilter.lustre-OST0000
To report current Lustre parameter values, use the lctl get_param command with this syntax:
lctl get_param [-n] <obdtype>.<obdname>.<proc_file_name>
This example reports data on RPC service times.
$ lctl get_param -n ost.*.ost_io.timeouts service : cur 1 worst 30 (at 1257150393, 85d23h58m54s ago) 1 1 1 1
This example reports the number of inodes available on each OST.
# lctl get_param osc.*.filesfree osc.myth-OST0000-osc-ffff88006dd20000.filesfree=217623 osc.myth-OST0001-osc-ffff88006dd20000.filesfree=5075042 osc.myth-OST0002-osc-ffff88006dd20000.filesfree=3762034 osc.myth-OST0003-osc-ffff88006dd20000.filesfree=91052 osc.myth-OST0004-osc-ffff88006dd20000.filesfree=129651
If a node has multiple network interfaces, it may have multiple NIDs. When a node is specified, all of its NIDs must be listed, delimited by commas (,) so other nodes can choose the NID that is appropriate for their network interfaces. When failover nodes are specified, they are delimited by a colon (:) or by repeating a keyword (--mgsnode= or --failnode=). To obtain all NIDs from a node (while LNET is running), run:
lctl list_nids
This displays the server's NIDs (networks configured to work with Lustre).
This example has a combined MGS/MDT failover pair on uml1 and uml2, and a OST failover pair on uml3 and uml4. There are corresponding Elan addresses on uml1 and uml2.
uml1> mkfs.lustre --fsname=testfs --mdt --mgs --failnode=uml2,2@elan /dev/sda1 uml1> mount -t lustre /dev/sda1 /mnt/test/mdt uml3> mkfs.lustre --fsname=testfs --ost --failnode=uml4 --mgsnode=uml1,1@elan --mgsnode=uml2,2@elan /dev/sdb uml3> mount -t lustre /dev/sdb /mnt/test/ost0 client> mount -t lustre uml1,1@elan:uml2,2@elan:/testfs /mnt/testfs uml1> umount /mnt/mdt uml2> mount -t lustre /dev/sda1 /mnt/test/mdt uml2> cat /proc/fs/lustre/mds/testfs-MDT0000/recovery_status
Where multiple NIDs are specified, comma-separation (for example, uml2,2@elan) means that the two NIDs refer to the same host, and that Lustre needs to choose the "best" one for communication. Colon-separation (for example, uml1:uml2) means that the two NIDs refer to two different hosts, and should be treated as failover locations (Lustre tries the first one, and if that fails, it tries the second one.)
If you want to erase a file system, run this command on your targets:
$ "mkfs.lustre -reformat"
If you are using a separate MGS and want to keep other file systems defined on that MGS, then set the writeconf flag on the MDT for that file system. The writeconf flag causes the configuration logs to be erased; they are regenerated the next time the servers start.
To set the writeconf flag on the MDT:
1. Unmount all clients/servers using this file system, run:
$ umount /mnt/lustre
2. Erase the file system and, presumably, replace it with another file system, run:
$ mkfs.lustre -reformat --fsname spfs --mdt --mgs /dev/sda
3. If you have a separate MGS (that you do not want to reformat), then add the "writeconf" flag to mkfs.lustre on the MDT, run:
$ mkfs.lustre --reformat --writeconf -fsname spfs --mdt \ --mgs /dev/sda
All current Lustre installations run the ldiskfs file system internally on service nodes. By default, ldiskfs reserves 5% of the disk space for the root user. In order to reclaim this space, run the following command on your OSSs:
tune2fs [-m reserved_blocks_percent] [device]
You do not need to shut down Lustre before running this command or restart it afterwards.
To copy the contents of an existing OST to a new OST (or an old MDS to a new MDS), use one of these methods:
mount -t ldiskfs /dev/old /mnt/ost_old mount -t ldiskfs /dev/new /mnt/ost_new rsync -aSv /mnt/ost_old/ /mnt/ost_new # note trailing slash on ost_old/
rsync -aSvz /mnt/ost_old/ new_ost_node:/mnt/ost_new
cd /mnt/mds_old; getfattr -R -e base64 -d . > /tmp/mdsea; \<copy all MDS files as above>; cd /mnt/mds_new; setfattr \--restore=/tmp/mdsea
Use this procedure to identify the file containing a given object on a given OST.
1. On the OST (as root), run debugfs to display the file identifier (FID) of the file associated with the object.
For example, if the object is 34976 on /dev/lustre/ost_test2, the debug command is:
# debugfs -c -R "stat /O/0/d$((34976 %32))/34976" /dev/lustre/ost_test2
debugfs 1.41.5.sun2 (23-Apr-2009) /dev/lustre/ost_test2: catastrophic mode - not reading inode or group bitmaps Inode: 352365 Type: regular Mode: 0666 Flags: 0x80000 Generation: 1574463214 Version: 0xea020000:00000000 User: 500 Group: 500 Size: 260096 File ACL: 0 Directory ACL: 0 Links: 1 Blockcount: 512 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009 atime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009 mtime: 0x4a216b48:00000000 -- Sat May 30 13:22:16 2009 crtime: 0x4a216b3c:975870dc -- Sat May 30 13:22:04 2009 Size of extra inode fields: 24 Extended attributes stored in inode body: fid = "e2 00 11 00 00 00 00 00 25 43 c1 87 00 00 00 00 a0 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " (32) BLOCKS: (0-63):47968-48031 TOTAL: 64
2. Note the FID’s EA and apply it to the osd_inode_id mapping.
In this example, the FID’s EA is:
e2001100000000002543c18700000000a0880000000000000000000000000000
struct osd_inode_id {
__u64 oii_ino; /* inode number */
__u32 oii_gen; /* inode generation */
__u32 oii_pad; /* alignment padding */
};
After swapping, you get an inode number of 0x001100e2 and generation of 0.
3. On the MDT (as root), use debugfs to find the file associated with the inode.
# debugfs -c -R "ncheck 0x001100e2" /dev/lustre/mdt_test
debugfs 1.41.5.sun2 (23-Apr-2009) /dev/lustre/mdt_test: catastrophic mode - not reading inode or group bitmaps Inode Pathname 1114338 /ROOT/brian-laptop-guest/clients/client11/~dmtmp/PWRPNT/ZD16.BMP
The command lists the inode and pathname associated with the object.
| Note - Debugfs' ''ncheck'' is a brute-force search that may take a long time to complete. |
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.