First, the Linux main file system type
①ext (2/3/4) XFS FFS UFS JFS vfat NTFS
② swap file System swap
③ Network File System NFS Smbfs
④ Distributed File System Ceph
⑤ Disc File System isso9660
Linux is the most traditional file system is the use of ext, so to understand the Linux file system, first starting from Ext. Ext has ext2, ext3, Ext4 and so on ext2 does not support the log function.
Second, create the partition
View partitions
Fdisk-l [DEVICE].
Creating partitions
fdisk [DEVICE]
Commands for interactive interfaces
P Show disk partition table
N New Partition
d Delete delete partition
T modify the ID of the partition system
L list The IDs that the system already has
W Save exit
Q Do not save exit
How is the script interactive? The following is the creation of a 20G logical partition
Echo '
N
+20g
W ' |FDISK/DEV/SDA
For disks that already have partitions in use, the newly created partition requires the kernel to re-read its partitions
CENTOS6 Kpart-af [DEVICE]
part-a [DEVICE]
Iii. Creating a file system (formatting)
Mkfs-t Fstype [DEVICE]
Example: Mkfs-t ext3 sda3=mkfs.ext3 Sda3
Format the disk Sda3 as a ext3 file system.
But generally for EXT system file system we pass MKE2FS command, its function will be more powerful
Mke2fs
-t {EXT2|EXT3|EXT4}: Specify File system
-B {1024|2048|4096}: Specify block size
-L LABEL: marking mke2fs-l label=e2label DEVICE LABEL
-j: Equivalent to-t ext3
-I #: Each number of bytes to create an inode, this number of bytes should not be less small block size
-N #: Specify the number of available inode directly;
-M #: Specifies the percentage of space reserved for the entire partition; default is 5;
-o: Specify partition attributes
Blkid: View information for a specified block device
E2label: View or set the volume label
E2label DEVICE [LABEL]
To view the Super block information:
# tune2fs-l DEVICE
# dumpe2fs-h DEVICE
Modify Partition properties: TUNE2FS
Block size cannot be adjusted;
-J:EXT2-Ext3
-L LABEL: Modify volume label
-M #: Modify the percentage of reserved space;
-O [^]feature: Enable the specified attribute, plus ^ for the attribute to turn off this feature
-O [^]mount-options: Toggle the specified mount option on or off
File system should be repaired when an abnormally aborted import write operation occurs due to an unexpected process abort or a system crash;
Note: Offline repair
Fsck
-T Fstype
-A: Auto fix error
-r: Interactive fix error
E2FSCK: Dedicated to modifying the EXT series file system
-y: Automatic answer to question Yes
-F: Force detection
Iv. Mounting
Only administrators have permissions by default
The process of associating an additional partition with a directory on the root file system;
Existing files in the directory will be hidden
Mount point: Access entry for another file system
Mount: Mount DEVICE mount_point
Fixed mount point:/mnt,/media
Mount [option] ... [-T Fstype] [-o-option] device mount point
Mount point:
1, pre-existing;
2, the use of free directory;
Common mount options:
-t fstype: Specify the file system type
-r:readonly, read-only Mount
-w:read and write, read-write Mount
-l LABEL: Specify device as volume, mount-l MYDATA mount point
-u UUID: Specify device as UUID, Mount Uuid= ' uuid ' Mount point, mount-u uuid mount point
-a: Automatically mounts all supported auto-mount devices (defined in the/etc/fstab file)
-n: The/etc/mtab file is not updated when mounting
-O Option:
Async: Asynchronous I/O, data writes are completed before memory, and then synchronized to a persistent device based on a policy
Sync: Synchronous I/O,
Atime/noatime: Updates the last access timestamp when files and directories are accessed
Auto/noauto: Whether the device supports mount-a option to mount automatically
Diratime/nodiratime: The last access timestamp is updated when the directory is accessed
Dev/nodev: Whether to support the use of devices on this device;
EXEC/NOEXEC: Whether binary program files on this device are allowed to execute
Suid/nosuid: Whether to support the use of suid on files on this device
Remount: Re-mount, typically used to reassign mount options without unloading
RO: Read-only
RW: Read and Write
User/nouser: Whether to allow normal mount of this file device
ACL: This device is supported by using FACL, which is not supported by default;
For example: With the specified mount support ACL as an example:
Method 1:
Mount-o ACL DEVICE mount_point
Method 2:
Tune2fs-o ACL DEVICE
Set default mount options for Devices
Mount DEVICE Mount_point
To view all devices that are already mounted:
# mount
# cat/proc/mounts
# Cat/etc/mtab
Uninstall: The mount point is not accessed by the process before it can be uninstalled;
Uninstall: Umount DEVICE
Umount Mount_point
See which processes are accessing the mounted device:
Fuser-v mount point
To abort a process that is in this mount point:
fuser-km mount point
Df:disk Free
-h:human-readable
-I: Display usage information for inode instead of default disk space usage information
Du:disk usage per size
-S: Total size (summary)
-H: Show recognizable units
V. Swap partitions
Mkswap
Free: View usage information for memory and swap partitions
Enable a swap partition device
Swapon [DEVICE]
-a:all, enable all swap partitions
-P #: Specifies the priority of this switching device
Disable a swap partition device
Swapoff [DEVICE]
-A: Disables all
Configuration files for automatically mounted devices:/etc/fstab
6 fields:
Mounted Devices:
Device files
LABEL
Uuid
Mount point:
File system type
Mount Options:
Mount options can have multiple, separated from each other using commas;
Dump frequency:
0: Never Dump
1: Daily dumps
2: Every other day
Self-Test order:
0: No self-test, additional file system created without automatic self-test
1: First self-test, usually only the root file system needs to self-test first
2: Secondary self-test, different devices can use the same self-test order
3
...
This article is from the "zero-based" blog, so be sure to keep this source http://zerofly.blog.51cto.com/4476065/1531127