Manage disk partitions

Manage disk partitions

 

  1. > Format: fdisk /dev/sda

            Note: can only point to devices and not partitions

  2. > Parameters:

      P : Displays the partition of the current hard disk, including unsaved changes

      n: create new partition

           e: extended partition

           P : primary partition

    d: delete a partition

    w: save and exit

    q: exit without saving

    t: Modify the partition type

    L : show all supported types

    l : show all types supported by multi

    Note:  Although w saves and exits, but the kernel does not recognize it, you can use the command to view

         

     

     

     

     

     

     

     

     

    Create a file system

     

     

    Command:  mkfs

    Full name: make file system

    Parameters: -t   filesystem type partition

     

    create log

     

    mkfs -t ext3 = mkfs.ext3

    Similar to view

     

     

     

    Specially manage ext series files:

    Command: mke2fs creates ext 2 filesystem by default

       -j   : Create an ext3 filesystem.

     

     

     

     

    -b BLOCK_SIZE: Specify the block size, the default is 4096 , the available values ​​are 1024, 2048 and 4096

     

     

     

    -L LABEL: Specify the partition label

     

     

    -m # : Specifies the percentage of blocks reserved for superusers

     

     

    -i # : used to specify how many bytes of space to create an inode , the default is 8192 , the value given here should be 2^n times the block size

     

     

    -N # : Specify the number of inodes

    -F : Force filesystem creation

    -E : User specifies additional filesystem attributes

     

  1. Query or view related properties of disk devices

     Command: blkid

     

     

  2. Used to view or define volume labels

       Command: e2lable   device file volume label

     

     

  3.  Adjust the relevant properties of the file system

    Command : tune2fs  

    Parameters: -j : Do not damage the original data, upgrade ext 2 to ext 3 , be careful not to downgrade

     

     

     

    -L LABEL: set or modify the volume label

     

     

    -m #调整预留百分比

    -r# 指定预留块数

    -o :设定默认挂载选项

       Acl

    -c: 指定挂载次数达到#此之后进行自检,0-1表示关闭 此功能

    -i : 每挂载使用多少天后进行自检, 0 -1 表示关闭 此功能

       备注: -c -i 使用的环境是大数据库读写时,正好达到自检时间,此时服务器性能会急剧下降

     

     

     

     

    -l 显示超级快中的信息

     

     

     

  4. dumpe2fs  (可兼容 ext4

    命令 dumpe2fs /dev/sdb1 = tune2fs -l /dev/sdb1

    注意:显示内容中我们可以看到每个快组中free

    Blocks (空闲块) ,对于使用的硬盘我们可能看到的空闲块是离散的,这意味着有碎片了

     

     

    参数 -h  :只想看超级块的信息

     

     

     

  5. Fsck

    解释;  解释并修复Linux 支持的所有文件系统

    参数  -t

    FSTYPE  :指定文件系统类型 ,注意:如果不指定, fsck 会自动调用blkid检测是哪种类型。

    -a:  自动修复

     

  6.  e2fsck

     解释:  专用于修复 ext2/ext3文件系统

    参数:  -f : 强制检查

              -p : 自动修复

     

     

     



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324483165&siteId=291194637