PTStudy Guide

Embed Size (px)

Citation preview

  • 7/23/2019 PTStudy Guide

    1/9

  • 7/23/2019 PTStudy Guide

    2/9

    (This is the default option.)

    -M Prints throughput in mbytes/sec

    -i [suboptions] Specifies suboptions describing the test youwant to perform

    To measure the I/O throughput of sequentially writing a 1024-MB file in 8K blocks,using the file testfile01at the mount point /mnt:

    #vxbench -w write -i iosize=8,iocount=131072 /mnt/testfile01

    To measure a random workload for writes in 8K blocks for a maximum file size of1024 MB:

    #vxbench -w rand_write -i iosize=8,iocount=131072,

    maxfilesize=1048576 /mnt/testfile01

    Tasks a file system supports include:

    Creating a directory structure to manage files Creating and deleting files Reading and writing file data Controlling file access and authentication

    Metadata comprises the structural information of the file system.

    1. An application makes an I/O request by issuing a system call to read or write

    data to a file. The format of this call is:

    read(fd,buffer,count)

    o fdis the file descriptor that identifies the file to read from.

    o bufferis the address of the memory location within the application

    into which the data is to be copied by the read.o countis the number of bytes to be read by the read I/O request.

    2. From this, the file system identifies the sequence of file system blocks thatcontain the relevant portion of the file.

    3. The file system checks the buffer cache to verify whether or not the requiredblocks are already in memory.

    o If the blocks are in memory, the requested data is copied from thoseblocks into the defined buffer.

    o If the blocks are not in memory, the blocks must first be retrievedfrom the underlying storage device.

    4. Using a mapping function (index tables), the file system converts the logicalblock address to the corresponding physical disk block address of the data.Metadata must be processed before any data is retrieved.

  • 7/23/2019 PTStudy Guide

    3/9

    5. After the physical block address is determined, the request is sent to theunderlying storage hardware device driver.

    6. The file system request passes from the device driver to the storage devicewhere all data is physically stored. The data then passes back up through thefile system layers and returns to the calling application.

    Common disk allocation methods are:

    Contiguous IBM VX Linked MS DOS Indexed VxFS UFS

    Contiguous allocation is a method of storing a file in adjacent disk blocks.

    Linked allocation is a method that involves the use of pointers to link disk blockstogether by reference.

    In an indexed allocation system, every file is associated with an index block.

    However, VxFS allocation is extent-based, while UFS allocation is block-based.

    Block-based allocation:File systems that use block-based allocation assigndisk space to a file one block at a time.

    Extent-based allocation:File systems that use extent-based allocationassign disk space in groups of contiguous blocks, called extents.

    UFS allocates space for files one block at a time. When allocating space to a file.Block-based allocation requires extra disk I/O to write fi le system block structureinformation, or metadata. Over time, block-based allocation produces a fragmented

    file system with random file access.

    VERITAS File System selects a contiguous range of file system blocks, called anextent, for inclusion in a file. The number of blocks in an extent varies and is basedon either the I/O pattern of the application, or explicit requests by the user orprogrammer. Extent-based allocation enables larger I/O operations to be passed tothe underlying drivers.

    Each file is associated with an index block, called an inode. In an inode, an extent isrepresented as an address-length pair, which identifies the starting block addressand the length of the extent in logical blocks.

    VxFS automatically selects an extent size that is based on the size of I/O writerequests.

    A VxFS inode contains:

    Information about a file, such as access times, file type, size, and permissions Address blocks that identify the location of each extent allocated to the file

    There are two types of address blocks within an inode:

  • 7/23/2019 PTStudy Guide

    4/9

    Direct address blockscontain addresses to the extents allocated to a file. Indirect address blockscontain pointers to associated address blocks that

    contain addresses to the extents allocated to a file.

    To display information about inodes and file system structure, you can use the ff

    and ncheckcommands. The ffcommand provides a quick view of files in a file

    system, and the ncheckcommand provides a more detailed, structural view of thefile system.

    VxFS selects a logical block size of 1K, 2K, 4K, or 8K, depending on the file systemsize:

    File System Size VxFS Logical Block Size

    x < 8 GB 1024 bytes (1K)

    8 GB < x < 16 GB 2048 bytes (2K)

    16 GB < x < 32 GB 4096 bytes (4K)

    x > 32 GB 8192 bytes (8K)

    The extent attributes of a file define the extent allocation policy for the file. Withoutextent attributes, space is allocated to a file on the basis of extents of increasingsize.

    setext [-e extent_size] [-f flags] [-r reservation] file

    Use the -eoption to specify a fixed extent size.

    Use the -roption to preallocate, or reserve, space for a file.

    Use the -foption to set allocation flags. You specify multiple flags by entering

    multiple instances of -fon the command line. Available allocation flags are:

    Flag Description

    align Specifies that all extents must be aligned onextent_sizeboundaries relative to the start of

    allocation units

    chgsize Immediately incorporates the reservation into the fileand updates the inode with size and block countinformation

    contig Specifies that the reservation be allocated contiguously

    noextend Specifies that the file may not be extended after thepreallocated space is used

    noreserve Specifies that the reservation is not a persistentattribute of the file. The space reserved is allocated onlyuntil the final close of the file, and then is freed. Thetemporary reservation is not visible to the user.

  • 7/23/2019 PTStudy Guide

    5/9

    trim Specifies that the reservation is reduced to the currentfile size after the last close by all processes that havethe file open

    Using the setextcommand, reserve 36 file system blocks for the file file1, specify

    a fixed extent size of 3 blocks, and align extents to 3-block boundaries. The file maynot be extended after the preallocated space is used.

    #setext -r 36 -e 3 -f align -f noextend file1

    You can view the extent attribute information associated with a file or set of files byusing the getextcommand:

    getext [-f] [-s] file. . .

    In the syntax, you specify the command, options, and the name of the file or files forwhich you want to display information.

    You add the -foption if you do not want to print the file name.

    You add the -soption if you do not want to print output for files without fixed

    extent sizes or reservations.

    The getextcommand is located in /opt/VRTSvxfs/sbin.

    To specify extent-aware versions of standard commands, you use the -eoption. The

    -eoption specifies extent preservation behavior and can be used with one of three

    values:

    Option Description

    -e warn Prints a warning if extent information cannot be preserved(This is the default option.)

    -e force Causes a copy to fail if extent information cannot bepreserved

    -e ignore Does not try to preserve extent information

    The four versions of the VERITAS file system layout are:

    Version 1 The Version 1 layout was the original layout for VxFSrelease 1.x. This version introduced intent logging, extent

    allocation, and unlimited inodes.

    Version 2 The Version 2 layout was introduced with VxFS release2.x. This version added dynamic inode allocation and

    support for access control lists and quotas to the Version 1layout.

    Version 3 The Version 3 layout is specific to the HP-UX operatingsystem.

    Version 4 The Version 4 la out is the latest file s stem la out and

  • 7/23/2019 PTStudy Guide

    6/9

    was introduced with VxFS release 3.2.x. The Version 4

    layout added large file support and the ability for extentsto span allocation units.

    To upgrade the VxFS file system layout, you use the vxpgradecommand. The

    vxupgradecommand only operates on file systems mounted for read/write access.The syntax for the command is:

    vxupgrade [-n new_version] [-o noquota] [-r rawdev] mount_point

    A VxFS with Version 2 file system layout is mounted at /mnt. To upgrade this file

    system to Version 4 layout, you type:

    #vxupgrade -n 4 /mnt

    To display the file system layout version number of a VERITAS file system mounted

    at /mnt, you type:

    #vxupgrade /mnt

    VxFS layout Version 4 includes the following structural components:

    Allocation units Structural files

    With VxFS layout Version 4, the entire file system space is divided into fixed-sizeallocation units. The first allocation unit starts at block zero, and all allocation unitsare a fixed length of 32K blocks.

    All structural information about the file system is contained in files within a structuralfileset. With the exception of the superblock, which has a known location, structuralfiles are not stored in a fixed location.

    To take advantage of VxFS structural components that are designed to help minimizefragmentation, you can convert existing UFS file systems to VERITAS file systems byusing the vxfsconvertutility.

    Free space required by vxfsconvertis approximately 12 to 15 percent of the total

    file system

    Running vxfsconverttakes approximately two to three times longer than running

    file system-specific fsckon UFS.

    Conversion options include:

    Option Description

    -e This o tion estimates the amount of s ace re uired to

  • 7/23/2019 PTStudy Guide

    7/9

    complete the conversion.

    -f This option displays the list of supported file system types

    -n|N|y|Y Use these options to assume a Yes (y|Y) or No (n|N)

    -s size This option specifies the amount of available disk space atthe end of the file system. sizeis in kilobytes. Disk space

    required for the conversion process is taken from the end ofthe file system.

    -v This option specifies verbose mode, which shows theprogress of the conversion process for every inodeconverted.

    VxFS addresses two types of fragmentation:

    Directory fragmentation

    As files are created and removed, gaps are left in directory inodes. This is

    known as directory fragmentation. Directory fragmentation causes directorylookups to become slower.

    Extent fragmentation

    As files are created and removed, the free extent map for an allocation unitchanges from having one large free area to having many smaller free areas.Extent fragmentation occurs when files cannot be allocated in contiguouschunks and more extents must be referenced to access a file.

    You use the fsadm command to run reports on both directory and extent

    fragmentation.

    The fsadm-Dcommand reports on directory fragmentation.

    The fsadm-Ecommand reports on extent fragmentation.

    Percentage UnfragmentedBadly

    Fragmented

    Percentage of free space inextents of less than 64 blocksin length

    < 5% > 50%

    Percentage of free space inextents of less than 8 blocks

    in length

    < 1% > 5%

    Percentage of total file systemsize in extents of length 64blocks or greater

    > 5% < 5%

    Option Description

    -d The -doption reorganizes directories. Directory entries

    are reordered to place subdirectory entries first, then allother entries in decreasin order of time of last access.

  • 7/23/2019 PTStudy Guide

    8/9

    The directory is also compacted to remove free space.

    -a You can use the -aoption in conjunction with the -d

    option to consider files not accessed within the specifiednumber of days as "aged" files. Aged files are moved tothe end of the directory. The default is 14 days.

    -e The -eoption reorganizes extents. Files are reorganizedto have the minimum number of extents.

    -D, -E The -Dand -Eoptions produce reports on directory and

    extent fragmentation, respectively.

    -v The -voption specifies verbose mode and reports

    reorganization activity. You can use the -voption to

    examine the amount of work performed by fsadm. You

    can adjust the frequency of reorganization based on therate of file system fragmentation.

    -l The -loption specifies the size of a file that is considered

    large. The default is 64 blocks. Extent reorganization tries

    to group large files into large extents of at least 64 blocks.-t The -toption specifies a maximum length of time to run

    in seconds.

    -p The -poption specifies a maximum number of passes to

    run. By default, fsadmruns five passes.

    -s The -soption prints a summary of activity at the end of

    each pass.

    -r The -roption specifies the pathname of the raw device to

    read to determine file layout and fragmentation. Thisoption is used when fsadmcannot determine the raw

    device.

    If you use the -Dand -Ewith the -dand -eoptions, the fragmentation reports are

    produced both before and after the reorganization.

    Defragmenting extents, called extent reorganization, can improve performance.

    During extent reorganization:

    Small files (less than 64K) are made into one contiguous extent. Large files are built from large extents. Small and recently used (less than 14 days) files are moved near the inode

    area. Large or old files (more than 14 days since last access) are moved to the end

    of the allocation unit. Free space is clustered in the center of the data area.

    VERITAS File System provides fast file system recovery after a system failure byusing a tracking feature called intent logging, or journaling.

  • 7/23/2019 PTStudy Guide

    9/9

    The intent log records pending changes to the file system structure and writes thelog records to disk in advance of the changes to the file system.

    The VxFS version of the fsckutility performs an intent log replay to recover a file

    system without completing a full structural check of the entire file system. The timerequired for log replay is proportional to the log size, not the file system size.

    The intent log is a circular activity log with a default size of 1024 blocks.

    The syntax for the fsckcommand is:

    fsck [-F vxfs] [generic_options] [-y|Y] [-n|N]

    [-o full,nolog] [-o p] special

    To check file system consistency by using the intent log for the VERITAS file systemon the volume datavol, you type:

    #fsck -F vxfs /dev/vx/rdsk/datadg/datavol

    To perform a full file system check without using the intent log for the VERITAS filesystem on the volume datavol, you type:

    #fsck -F vxfs -o full,nolog /dev/vx/rdsk/datadg/datavol

    To check two file systems in parallel using the intent log:

    #fsck -F vxfs -o p /dev/rdsk/c1t2d0s4 /dev/rdsk/c1t0d0s5

    Applications invoke I/O operations in two general ways:

    Synchronously Asynchronously