[root@szm fdisk]# tune2fs 

tune2fs 1.41.12 (17-May-2010)

Usage: tune2fs [-c max_mounts_count] [-e errors_behavior]--检查行为 [-g group]

[-i interval[d|m|w]]--健康检查频率 [-j] [-J journal_options] [-l]--文件系统信息

[-m reserved_blocks_percent]--保留块比率 [-o [^]mount_options[,...]] 

[-r reserved_blocks_count] [-u user] [-C mount_count] [-L volume_label]

[-M last_mounted_dir] [-O [^]feature[,...]]---设置清除文件系统的功能

[-E extended-option[,...]] [-T last_check_time] [-U UUID]

[ -I new_inode_size ] device

 错误行为参数:“-e errors_behavior”当内核使用e2fsck(8)命令执行文件系统的健康检查时发现文件系统错误之后,执行何种操作;为内核所定义的行为有三种:Continue执行正常检查,Remount-ro将文件系统用只读的方式重新挂载,Panic执行内核崩溃行为。
 [root@szm fdisk]# tune2fs -l /dev/sda1 | grep -i behavior-------建议不要做修改
Errors behavior:          Continue
 
[root@szm fdisk]# tune2fs -l /dev/sda1 | grep -i block
Block count:              512000
Reserved block count:     25600-----------------------m参数的使用
Free blocks:              425482
First block:              1
Block size:               1024
Reserved GDT blocks:      256
Blocks per group:         8192
Inode blocks per group:   254
Flex block group size:    16
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
Journal backup:           inode blocks
 

 [root@szm fdisk]# tune2fs -l /dev/sda1 | grep -i name 

Filesystem volume name:   <none>----------------------------L参数的使用

 文件系统体检命令:e2fsck\fsck,要体检的文件系统要卸载,不卸载可能会破坏文件系统,使用fsck就是使用esfsck,这两个命令是一样的。
 
[root@szm fdisk]# fsck --help
fsck from util-linux-ng 2.17.2
fsck.ext4: invalid option -- 'h'
Usage: fsck.ext4 [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file]  [-C fd]--显示当前检查进度 [-j external_journal]
[-E extended-options] device
 
Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list
 
 卷标的修改:e2lable、blkid、tune2fs -L 、mafs -L

 [root@szm fdisk]# e2label /dev/sda1 szm1

[root@szm fdisk]# e2label /dev/sda1     

szm1

 

[root@szm fdisk]# blkid -h

blkid from util-linux-ng 2.17.2 (libblkid 2.17.0, 22-Mar-2010)

Usage:

  blkid -L <label> | -U <uuid>

 

  blkid [-c <file>] [-ghlLv] [-o format] [-s <tag>] 

        [-t <token>] [-w <file>] [dev ...]

 

  blkid -p [-s <tag>] [-O <offset>] [-S <size>]

        [-o format] <dev> [dev ...]

 

  blkid -i [-s <tag>] [-o format] <dev> [dev ...]

 

Options:

  -c <file>   cache file (default: /etc/blkid/blkid.tab, /dev/null = none)

  -h          print this usage message and exit---查询信息

  -g          garbage collect the blkid cache

  -o <format> output format; can be one of:

              value, device, list, udev, export or full; (default: full)

  -s <tag>    show specified tag(s) (default show all tags)

  -t <token>  find device with a specific token (NAME=value pair)

  -l          lookup the the first device with arguments specified by -t

  -L <label>  convert LABEL to device name

  -U <uuid>   convert UUID to device name

  -v          print version and exit

  -w <file>   write cache to different file (/dev/null = no write)---缓存信息

  <dev>       specify device(s) to probe (default: all devices)

 

Low-level probing options:

  -p          low-level superblocks probing (bypass cache)

  -i          gather information about I/O limits

  -S <bytes>  overwrite device size

  -O <bytes>  probe at the given offset

  -u <list>   filter by "usage" (e.g. -u filesystem,raid)

 

[root@szm fdisk]# blkid

/dev/sda1: UUID="17968cbe-9f85-42bf-bad1-a341e83b1632" TYPE="ext4" LABEL="szm1" 

/dev/sda2: UUID="SFNUh7-hkuw-3Rly-kkzl-tD7V-cxMg-b0OdEN" TYPE="LVM2_member" 

/dev/mapper/vg_szm-lv_root: UUID="c84cebb9-4f4d-4437-bfc0-4a4c3d829d8d" TYPE="ext4" 

/dev/mapper/vg_szm-lv_swap: UUID="ea5eb7dd-8a35-4f55-a5d7-1eba18451b1f" TYPE="swap" 

/dev/sdb5: UUID="LJrFaY-63bg-bQ4l-ZQhY-uB8w-XH0N-HN80nC" TYPE="LVM2_member" 

/dev/mapper/szmvg-szmspace: UUID="56dc9273-e651-4ed3-99d2-602a75f91022" TYPE="ext4" 

 通过UUID或LABEL得到文件系统
[root@szm fdisk]# findfs --help
Usage: findfs LABEL=<label>|UUID=<uuid>

 

 

 

[root@szm fdisk]# findfs LABEL=szm1

/dev/sda1

[root@szm fdisk]# findfs UUID=17968cbe-9f85-42bf-bad1-a341e83b1632

/dev/sda1

[root@szm fdisk]# man mount

 

 挂载所有文件系统:a

只读挂载:r

读写挂载:w

卷标挂载:L

指定挂载文件系统:t

挂载文件系统时指定挂载功能:o

重复挂载特定目录:--bind
 
显示已挂载文件系统卷标名称:l
 
卸载文件系统时更新/etc/mtab文件:n

 

 

[root@szm fdisk]# mount------------调用/proc/mounts,查看已经挂载的文件系统,内核会时实更新mtab文件

/dev/mapper/vg_szm-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)

vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

nfsd on /proc/fs/nfsd type nfsd (rw)

[root@szm fdisk]# mount -l
/dev/mapper/vg_szm-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw) [szm1]
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
 
[root@szm fdisk]# mount /dev/sda3 -o ro,noexec,sync /mnt/sdb3
 
[root@szm fdisk]# umont -h    
bash: umont: command not found
[root@szm fdisk]# umount -h
Usage: umount -h | -V
       umount -a [-d]  [-f]--强制卸载 [-r]  [-n]--不实时更新/etc/mmtab [-v] [-t vfstypes] [-O opts]
       umount [-d] [-f]  [-r] [-n] [-v] special | node...
r:如果文件系统挂载失败,尝试用只读方式挂载文件系统;
a:卸载/etc/mtab配置文件中的所有文件系统
 
 文件系统卸载不成功:fuser、lsof
[root@szm fdisk]# fuser
No process specification given
Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
             [ - ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
       fuser -l
       fuser -V
Show which processes use the named files, sockets, or filesystems.
 
    -a        display unused files too
    -c        mounted FS
    -f        silently ignored (for POSIX compatibility)
    -i        ask before killing (ignored without -k)
    -k        kill processes accessing the named file
    -l        list available signal names
    -m        show all processes using the named filesystems
    -n SPACE  search in this name space (file, udp, or tcp)
    -s        silent operation
    -SIGNAL   send this signal instead of SIGKILL
    -u        display user IDs
    -v        verbose output
    -V        display version information
    -4        search IPv4 sockets only
    -6        search IPv6 sockets only
    -         reset options
 
  udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]
[root@szm fdisk]# fuser -mu /mnt/file/
[root@szm fdisk]# fuser -km /mnt/file/
 
[root@szm fdisk]# lsof /proc/fs/nfsd
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rpc.mount 12638 root   20r   REG   0,31        0   10 /proc/fs/nfsd/export_features
rpc.nfsd  12693 root    3w   REG   0,31        0   18 /proc/fs/nfsd/portlist
 
[root@szm fdisk]# man 5  fstab ----查看每行的意思
 

 autofs:/etc/auto.master------->/etc/auto.misc

nfs         -fstype=nfs,ro,soft,intr          192.168.1.1:/var/ftp/pub

[root@szm misc]# service autofs restart

 

[root@szm misc]# ls nfs

 

 
[szm@szm Desktop]$ gnome-mount ????????????????????????
 

 [root@szm misc]# gzip --help

Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs ( by default, compress FILES in-place).
 
Mandatory arguments to long options are mandatory for short options too.
 
   -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
    --rsyncable   Make rsync-friendly archive
 
With no FILE, or when FILE is -, read standard input.
 
Report bugs to <bug-gzip@gnu.org>.
 
[root@szm tmp]# gzip passwd 
[root@szm tmp]# ls passwd.gz 
passwd.gz
[root@szm tmp]# gzip -d passwd.gz
 
[root@szm tmp]# gunzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).
 
Mandatory arguments to long options are mandatory for short options too.
 
  -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
    --rsyncable   Make rsync-friendly archive
 
With no FILE, or when FILE is -, read standard input.
 
Report bugs to <bug-gzip@gnu.org>.
 
[root@szm tmp]# bzip2 -h -----------------------压缩率比gzip高
bzip2, a block-sorting file compressor.  Version 1.0.5, 10-Dec-2007.
 
   usage: bzip2 [flags and input files in any order]
 
   -h --help           print this message
   -d --decompress     force decompression
   -z --compress       force compression
   -k --keep           keep (don't delete) input files
   -f --force          overwrite existing output files
   -t --test           test compressed file integrity
   -c --stdout         output to standard out
   -q --quiet          suppress noncritical error messages
   -v --verbose        be verbose (a 2nd -v gives more)
   -L --license        display software version & license
   -V --version        display software version & license
   -s --small          use less memory (at most 2500k)
   -1 .. -9            set block size to 100k .. 900k
   --fast              alias for -1
   --best              alias for -9
 
   If invoked as `bzip2', default action is to compress.
              as `bunzip2',  default action is to decompress.
              as `bzcat', default action is to decompress to stdout.
 
   If no file names are given, bzip2 compresses or decompresses
   from standard input to standard output.  You can combine
   short flags, so `-v -4' means the same as -v4 or -4v, &c.
[root@szm tmp]# dd if=/dev/zero of=file bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.23109 s, 85.2 MB/s
[root@szm tmp]# dd if=/dev/zero of=file1 bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.31938 s, 79.5 MB/s
[root@szm tmp]# time gzip file
 
real 0m1.676s
user 0m0.973s
sys 0m0.568s
[root@szm tmp]# time bzip2 file
bzip2: Can't open input file file: No such file or directory.
 
real 0m0.023s
user 0m0.000s
sys 0m0.005s
[root@szm tmp]# time bzip2 file1
 
real 0m4.218s
user 0m3.226s
sys 0m0.612s
[root@szm tmp]# ll file* ------------高压缩比但花CPU时间多
-rw-r--r--. 1 root root    113 Mar  7 23:43 file1.bz2
-rw-r--r--. 1 root root 101796 Mar  7 23:43 file.gz
 
[root@szm tmp]# bunzip2 -h
bzip2, a block-sorting file compressor.  Version 1.0.5, 10-Dec-2007.
 
   usage: bunzip2 [flags and input files in any order]
 
   -h --help           print this message
   -d --decompress     force decompression
   -z --compress       force compression
   -k --keep           keep (don't delete) input files----不删除原文件
   -f --force          overwrite existing output files----强制覆盖压缩文件与压缩链接
   -t --test           test compressed file integrity
   -c --stdout         output to standard out---将压缩的数据输出到屏幕上,不更改原文件
   -q --quiet          suppress noncritical error messages
   -v --verbose        be verbose (a 2nd -v gives more)
   -L --license        display software version & license
   -V --version        display software version & license
   -s --small          use less memory (at most 2500k)
   -1 .. -9            set block size to 100k .. 900k
   --fast              alias for -1
   --best              alias for -9
 
   If invoked as `bzip2', default action is to compress.
              as `bunzip2',  default action is to decompress.
              as `bzcat', default action is to decompress to stdout.
 
   If no file names are given, bzip2 compresses or decompresses
   from standard input to standard output.  You can combine
   short flags, so `-v -4' means the same as -v4 or -4v, &c.