Linux Learning log (vi)

Source: Internet
Author: User

File system

access by name is a primary purpose of file system existence
Definition: The file system is a software that manages the binary that exists on the disk

 MBR:Master Boot Record 主引导记录512byte:    bootloader:记载器,4 46bytes    fat:每16个字节引导一个分区,    MBR有效性标记:5A  4个主分区      3主,1扩展分区,引用其他额外的分区表  逻辑分区

Hard disk:

    存放位置 /dev

HDD Interface:

  IDE(ATA):并口,每个控制器可接两个硬盘,master/slave,133MB/S    /dev/hd[a-z]      /dev//hda[1-4]      逻辑分区5开始      /dev/hda[5+]  SCSI:Small Computer System Interface 小型计算机接口      320mb/s  SATA(Serial):300Mbps,600Mbps,6Gbps  SAS:6Gbps  DMA:Direct Memory Access直接内存访问机制 USB:   /dev/sd[a-z]       [1-4]       [5+  ]
Vfs:

File system:

Raw

  没有做任何的文件系统  

Implementing the Partitioning tool:

   fdisk sfdisk parted
Fdisk
d 删除分区n:新建一个分区p:列出已有分区t:调至分区IDl:列出内核支持的分区idw:保存退出q:不保存退出 m:帮助

Centos5:partprobe
Centos6:partx Kpartx

 kpartx -l /dev/sda kpartx -af /dev/sda partx -a /dev/sda
MKFS: Used to format
-t 文件系统 :指定文件系统以后来格式化分区    mke2fs -t Ext4:mkfs -t ext4 = mkfs.ext4 = mke2fs -t ext4 Ext3(日志文件系统):mkfs -t ext3 = mkfs.ext3 = mke2fs -t ext3 = mke2fs -j

MKE2FS:

   配置文件:/etc/mke2fs.conf   -t:指定文件类型   -j:   -L label: 指定卷标,   -b{1024|2028|4096}:指定块大小   -i # :#个字节给指定一个indone   -N # : 直接指定预留多少个indone   -I # : 指定Inode大小   -m # :预留给管理员的空间百分比,默认为5   -O :指定分区特性

E2label

e2label /dev/SOMEDEVICE 查看卷标,e2label /dev/SOMEDEVICE  Label 直接更改卷标

Blkid

   格式:blkid /dev/SOMEDEVICE   查看设备的属性,UUID和TYPE

DUMPE2FS View Super blocks and whether there are fragments

    -h:仅显示超级块中保存的信息tune2fs:调整mke2fs的信息      -l:查看超级块中的信息      -L: 设定卷标      -m:预留管理员的空间百分比      -j:如果原来的文件系统为ext2,-j能够将其提升为ext3      -o:[^]mount-options[,...] 指定默认挂载选项      -O:[^]feature[,...] 调整分区特性      tune2fs -o 挂载选项 设备      tune2fs -o ^设备选项 取消   

FSCK: File System detection

-t 文件类型 设备-f 强行检测-a 自动修复错误-r 交互式修复错误

E2fsck-t Specified time

   -y 自动回答为yes   -f 强行检测

Swap partition:

  虚拟内存

Mkswap formatted as virtual memory

  -L label 指定卷标

Swapon Starting virtual memory

  -a 启动所有的虚拟分区  -p:指定优先级

Swapoff shutting down virtual memory

Get information about an IDE disk
Hdparm

-i 从操作系统读取-I 直接从硬盘读取-g 显示硬盘的布局信息-t 测试硬盘的性能-T 测试硬盘的性能

*/proc/partitions view hangs in information
/proc/meminfo
Type of file system for nuclear energy identification in/proc/filesystems *

Mount:

Manual mount: Mount as needed
Mount on Demand: AutoFS automatic file system when someone accesses it, mount it.
Auto mount on Boot

Command

mount[options] -t 文件类型 -o option 设备 挂载点 [options] : 命令的选项   -n:不更新/etc/mtab文件   --bind:dir1 dir2 将目录挂载到目录上,使得dir2也能访问dir1的文件   -t fstype   -r 只读挂载   -w:读写挂载   -L lable 以卷标指定,也可以使用LABLE="lable"   -U UUID:使用UUID挂载,也可以使用 UUID="uuid"

-O options: Start partition feature when mounted

     async:异步I/O     sync:同步I/O     noatime/atime 是否更新文件时间戳,不是特别重要的文件,建议noatime     auto: 是否能够被mount -a 自动挂载所有(/etc/fstab中)的文件自动挂载     dev/nodev:是否能创建设备文件     diratime/nodirtime:是否更新目录的时间戳     exec/noexec:是否允许执行二进制程序     _netdev:网络设备     remount:重新挂载     relatime/norelatime 是否实时更新     acl 文件访问控制列表 ##tune2fs -o mount-option  设备 设置属性  ##tune2fs -o ^mount-option 设备 取消默认挂载属性

Mount point: The original data will be hidden after mounting

      1、选择空闲目录      2、必须事先存在

Unloading:

    

Use mount directly to display the current system's mount information, or to view/proc/mounts or/etc/mtab

Disc:
/dev/cdrom/dev/dvdrom/dev/sr0

 [-t iso9660]

To view the process of owning a mounted device

     fuser -v 挂载点     fuser -km 挂载点 强制剔除shell进程

DF Disk space Usage Status report

df [options] [device]         -h:显示易读的信息   -i:显示indoen   -P:全部显示

Du shows how a file occupies a disk

  -s :整个目录大小  -h : 显示易读信息
Auto mount on Boot
 /etc/rc.d/rc.sysinit: One of the functions of the system initialization script: Mount the file system Mount table defined in the/etc/fstab file/dev/mapper/vg0-root/ext4 Defa Ults 1 1uuid=58894bb8-5b23-4f00-baff-0c19d450bfe9/boot ext4 defaults 1 2/DEV/MAPPER/VG 0-USR/USR ext4 defaults 1 2/dev/mapper/vg0-var/var ext4 Defau                LTS 1 2/dev/mapper/vg0-swap Swap swap defaults 0 0TMPFS/DEV/SHM                    TMPFS defaults 0 0devpts/dev/pts devpts gid=5,mode=620 0 0sysfs     /sys sysfs defaults 0 0proc/proc proc             Defaults 0 0 # #要挂载的设备: Device file, label= "UUID # #挂载点: Swap no mount point, mount point is swap # #文件系统类型 # #挂载选项: Use commas to separate # #转储频率 between multiple options:              0: Never backup 1: Daily Backup 2: Backup every other day # #自检次序 1: First self-test, usually only/used 2-9: Order 0: NeverSelf-Test 
Swap partition:

There is not enough physical memory to use the swap partition

linux使用内存机制:/proc/sys/vm/swapiness

How much to choose:

   大于2G,小于4G =4G   小于2G =2*物理内存   8G+:=4G

View memory space usage status

   cat /proc/meninfo   free       -m:显示结果以MB为单位      -g:显示结果以GB为单
Local loopback device
  使用情况:磁盘没有空间,创建不了新的分区,有空闲的空间可以用,交换分区不够用

DD Command:

   bs:一次读多大的数据量   count:读取次数   if:输入文件   of:输出文件   oflag=FLAGS 写出数据时的格式  #格式:     dd if=input_file of=output_file   dd if=input_file of=output_file bs=#[b|k|m|g] count=###/dev/zero:吐01的
File link

ln source file Destination file

硬链接:     不能跨分区, 指向同一个indone的两个位置     不能对目录创建硬链接 硬链接会改变文件被链接的次数

Symbolic Link: ln-s

 符号链接可以跨分区 符号链接文件跟源文件不同一个inode 可以对目录创建符号链接 符号链接不会改变源文件被链接的次数
Compression tools

Zip:

  gzip:gunzip= gzip -d,zcat      后缀:.gz      -c 将压缩结果送往标准输出,可以使用重定向将其保存在压缩文件,从而保留文件   bzip2,bunzip2 =bzip2 -d             -k 保留源文件          后缀 .bz    xz      后缀.xz -#:指定压缩比 1-9,默认的为6
Archive tool:
   tar [options] -f file.tar file1....    -c: 创建归档    -x:展开归档    -t:不展开而直接查看被归档的文件    -z:使用gzip压缩    -j:使用bz2压缩    -J:使用xz压缩       通常使用 zcf  zxf jcf jxf Jcf Jxf      命令总结 hdparm ln,dd,df,du,gzip,gunzip,zcat,bzipw,bunzip2,bzcat,zip,unzip,xz,unxz,xzcat,tar

Linux Learning log (vi)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.