A summary of Linux disk formatting and management knowledge points

Source: Internet
Author: User
Tags file system reserved uuid

The format of the disk is to create a file system, then how to implement the format? Here's a description of the commands and usage to format the disk

 

First, let's get to know the file system on Linux.

  /: root directory
   /bin: binary, executable command
   /sbin: Executable command, only for administration, usually only administrators have permission to use.
   /boot: Boot, the operating system used to boot system startup files, typically the kernel
    dev: device files
              Linux Device type
              character devices: Files that start with C, linear devices
              block devices: Files that start with B, random devices
   /etc: Profiles
   /home: User's home directory,/home/ Username,eg:jerry,/home/jerry
   /lib,/lib64: library file
   /media: mount point directory, Typically used for hanging on portable devices
   /mnt: mount point directories, hanging on additional file systems
   /misc: Backup directory
   / NET
   /opt Optional directory, usually third-party software installed occasionally on this path
   /proc: pseudo-file system, kernel mapping in memory
    /selinux: Security-enhanced Linux
   /srv:service  is part of the service's intermediate data storage location
   /sys:Similar to proc, typically used to access acquisition hardware device properties Information
   /tmp: Temporary files directory
   /usr: storing read-only files
    /var: Files that are often changed, such as logs
file systems are usually provided by the kernel, and the file systems inside windows are: NTFS, fat32  Linux inside the file system mainly by EXT2,EXT3,EXT4,XFS, Reiserfs,nfs,iso9600,jfs,brtfs

The format of the disk is to create a file system, then how to implement the format? Here's a description of the commands and usage to format the disk

The first step; partition

fdisk [DEVICE]
D Delete a partition
n Create a new partition
W Save exit
Q Do not save exit
The system ID corresponding to each partition type
T modifies the system ID of the specified partition
Method for the kernel to reread the partition table after partitioning
1, restart the system
2, RHEL5 on the use of Partprobe [DEVICE] Implementation
REHL6 using Partx-a [PARTITION] DEVICE implementation

Step two: Format the partitions and create the file system

Mkfs-t Fstype/dev/part = mke2fs-t Fstype/dev/part
Important: 1, the file system must be supported by the kernel to use, that is, the kernel has the corresponding kernel module, or has
Integrate it into the kernel;
2, to have the corresponding file system creation tool, this is usually mkfs.fstype

mke2fs-t {EXT2|EXT3|EXT4}
-B {1024|2048|4096}: Block size
Block size depends on CPU support for memory page frame size, x86 system default page frame size is 4K;
-L Label: Set Volume label
-M #: reserved for the proportion of total space occupied by the blocks used by the management;
-R #: The number of blocks reserved for management use;
-E: Set the extended properties of the file system;

Tune2fs
-L: Displays file system super block information;
-L Label: re-set the volume label;
-M #: Adjusts the proportion of the total space occupied by the blocks reserved for administration;
-R #: Adjusts the number of blocks reserved for management use;
-O: Set mount default options
-O: Set file system default attributes
-E: Adjusting the extended properties of the file system

Blkid DEVICE display device uuid, file system type, and volume label

The third step is to mount

  Mount [t-fstype] DEVICE mount_point
  Mount [-t Fstype] label= "volume label"   Mount_point
  Mount [-T Fstype] Uuid= the "UUID"   Mount_point
Mount, the existing data is hidden and cannot be mounted on the system's common directory;
When you uninstall, make sure that no process is accessing the mounted device; otherwise, you cannot uninstall;
 -o Used to specify the hanging option.
       ro: read-only mount;
       RW: Read and write, the default is read and write;
  noatime: Turn off update access time;
     Auto: Can be mounted by "mount-a";
 defaults: Equivalent to RW, suid, dev , exec, auto, nouser, async, and Relatime
     sync: Synchronous Write
    async: Asynchronous Write
de V:
 remount: Re-mount
 loop: Local loopback device,
 -n  on system without updating device files
 -r  read-only mount, equivalent to "-O ro" br> free view memory size
  m: space size conversion to MB
  g: space size conversion to GB

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.