Linux memory disk management commands notes

Memory View command

  free use of memory and can be viewed free swap usage

    For a more user-friendly display can use parameters -mgt the results by (MGT) to display the default kb

  top top command to display the dynamic memory usage and swap

Disk View command

  fdisk -l can view disk and partition cases

  df -h can also view the disk mount case

  du file to view the file size of the file can be used -mgt

    du view the file size of the actual space ls information see the file size in the inode

  dd if = / dev / zero bs = 4M count = 10 seek = 20 of = bfile copy of bytes from if to

    bs as blocksize count is the number of bs seek to seek Where to start from bfile used to create the file empty

Filesystem  common file system ext4 (manjaro) xfs (centos)here is ext4 record basic information:

  Superblock beginning of the disk portion of the recording disk partition information will be more important superblock copy

  inode i-node other than the file name to save the file information (file name stored in the inode parent directory) can be used to view files ls -i inode numbers

  datablock save the contents of the file pointer to the inode will datablock inode is a vivid metaphor for the datablock locomotive train cars

  Some operations inode changes:

    cp Copy a file creates two files inode number of different

    mv renaming within the same directory inode number change   depending on when not operating within the same directory is not in the same partition may be operating in the same block partition quickly just rename it no longer will need to copy the same partition

    vim before and after the file using vim inode numbers different in vim when .swp will produce a file in the directory to save the original file will quit vim

    rm disconnect the link between the file name and file inode so no matter how much always delete files quickly

    ln increase file when the link between the name and the inode use only ln can not cross operation is called common connection

    ln -s can cross operation is called a symbolic link will generate a new inode 777 permissions for the linked file permission changes will affect without affecting the linked file is a symbolic link file

  facl ask file access control list records file permissions information

    getfacl file get file information file permissions

    setfacl -mu: user1: rw file set permissions on the file to user1 RW -m impart appropriate permissions -x revoke permissions u: represents a respective set user rights g: setting group permissions 

    Configuration file / etc / fstab /

      / Dev / sda / mnt / sdc1 ext4 (file type) Defaults (read default settings) 0 (whether or not backup) 0 (if POST)

Partitions and mount

  fdisk / dev / sda to partition the disk sda

  mkfs.ext4 / dev / sda when the disk is formatted as ext4 sda type (format to another format in the mkfs.ext4 replace other formats ext4

  mount -t ext4 / dev / sda / mnt / sdc1 the sda mount sdc1 -t specified file system types

  The above steps are only a temporary partition (records stored in the memory) is still valid if you want to restart the system after the need to modify the configuration file / etc / fstab

  parted on T unit level disk operations

User disk quotas to restrict users to use the system disk resources

  Use when mounting mount -o uqota, gqota support disk quotas

  Then use xfs_quota command operations inode number b i restriction limits the number of datablock

Swap supplement when using an existing swap partition is not enough you can use Disk Expansion can also use the file expansion

  mkswap with a new hard drive to expand and then format the mount

  swapon open swap swapoff closed swap

  File expansion can create a file using the dd command and then mount format

RAID disk entire column

  RAID0 Striping striped two disk mode operation for increased throughput

  RAID1 the mirroring in the mirror mode is generally used to reduce the capacity of the backup and high reliability

  RAID5 parity three disks

  RAID10 combines RAID0 and RAID1 method requires four disk

    Software RAID mdadm command

Logical to physical volumes in a volume group and a logical volume may be redistributed as desired use pvcreate vgcreate lvcreate pvs lvs commands

 

Guess you like

Origin www.cnblogs.com/kkcoolest/p/11729643.html