File system Management of Linux Learning

Source: Internet
Author: User
Tags readable disk usage

File system Management of Linux Learning

One, Linux file System management:

Mkfs

Mkfs-t Type=mkfs.type: That means the effect of the two usages is consistent

1, Ext's proprietary file System Format tool

Mke2fs

Usage:

MKE2FS [option] .... DEVICE

[option]: Parameter

-t {EXT2|EXT3|EXT4}: Specifies the type of ext file system

-B {1024|2048|4096}: Specifies the block size, if the stored file is a large file, then the block size should be selected 4096, block size should be based on the storage file to decide, or based on experience to choose;

-L ' Lebel ': Specify volume label

-j:has_journal log function, equal to Mke2fs-t ext3, you can use this command to upgrade the Ext2 file system to the Ext3 file system without affecting the data;

-I. #:inode

The number of-n #:inode

-M #: Reserved disk space occupies a large percentage of space for subsequent management use, after default with%

-O feature[...]: Specifies the feature that opens the file system;

-O ^feayure[....] : Turn off this attribute

2. File System Properties View and Adjustment tool:

A, E2label

E2label DEVICE [LABEL]

B, tune2fs: Display the properties of the Ext series file system, or adjust the period attributes;

-L: Displays information in the super block, displaying information about the properties and layout of the entire file

-L ' LABEL ': Modify volume label

-M #: Adjust the percentage of administrative space reserved to administrators;

-J: Turn on its log function, can ext2 file system upgrade to ext3 file system

-O: File System Properties start or close

-O: File system default mount option enabled or closed


C, DUMPE2FS:

-H: Show only Super block information


3, File system detection:

Fsck:filesystem Check

FSCK-T type

Fsck.type

-A: Auto fix error

-r: Interactive fix error

-F: Force detection

E2fsck:ext Series file system-specific detection and repair tools

-Y: Auto answer ' yes '

-f:force


4. File system mount and use

An association between an additional file system and an existing directory of the file system, which allows this directory to be accessed as an entry for other file systems, is called mount

The process of releasing this association is called unloading;

Device mounted directories are called mount points

Note: After the mount point is mounted, the original file inside it will be hidden until it is uninstalled, so it is recommended to use a blank directory for the Mount point

Mount Method:

Mount: Displays all mounted devices of the current system by reading the/etc/mtab file;

Mount-a: Mount/etc/fstab file in Germany all support automatic mount file system

Mount [option] [-o-option] DEVICE Mount_point

[option]: Command options

[-o option]: Mount option


Device: Devices to be mounted

1), equipment files such as/DEV/SDA

2), Volume Label:-L ' LABEL '

3), UUID

4), pseudo file system name

Mount_point: Mount point

[option]: Command options

-T type: File system type

-r: Mount this file system as read-only

-W: Mount this file system in read-write mode

-N: Each file system is mounted automatically updates the/etc/mtab file,-n is used to prohibit sub-function, if you want to view all mounted file system, you can use Cat/proc/mounts

-A: Automatically mount all devices that support automatic mounting

-B: Bind directory to another directory


[-o option] Mount option

-async: Asynchronous mode

-sync: Synchronous mode

Atime/noatime: Whether to update the access timestamp

Diratime/nodiratime: Whether to update the access timestamp of the directory

Auto/noauto: Whether the secondary device is allowed to be mounted automatically

Exec/noexec: Whether the application on this file system is allowed to execute

Dev/nodev: Whether to support the use of device files on this device

Suid/nosuid: Whether special permissions are supported on this device

Remount: Re-mount

RO: Read-only

RW: Read and Write

User/nouser: Whether to allow normal users to mount this device

ACL: whether to support the use of FACL on this device

DEFAULTS:RW, suid, Dev, exec, auto, Nouser, and Async


Umount: Uninstall command

Umount DEVICE

Umount Mount_point

View the process that is accessing the specified mount point;

Fuser-v Mount_point

Terminates all processes that are accessing the specified mount point

fuser-km Mount_point


5. Swap partition

Free command:

View the usage status of memory and swap

-M: in megabytes

-G: in gigabytes

Mkswap: Creating Swap partitions

mkswap [option] DEVICE

-L ' LABEL '

Swapon: Enable swap partition

swapon [option] [DEVICE]

-A: Activate all swap partitions

-P Priority: set its precedence

Swapoff: Disable swap partition

swapoff [option] [DEVICE]


6. Viewing tools for space occupancy information such as file systems

DF du

Df:disk Free

-H: Displayed in a human-readable way

Number of-i:inode

-P: Output in POSIX-compatible format

Du:disk usage

-H: Displayed in a human-readable way

-S: and


7. File system-related mount configuration file/etc/fstab

Each row defines a file system

The format is as follows:

To mount a device or pseudo-file with mount point file system type Mount options dump frequency self-test order


The device to Mount

Device file, volume label, UUID, pseudo file system name


Mount Options

Defaults

Dump frequency

0: No dumps

1: Daily dumps

2: Dump every other day


Self-Test order:

0: No self-test

1: First self-test, usually with the directory use

2:


8. link file on file system

There are two types of linked files:

Hard Links:

Two paths pointing to the same inode

The directory cannot be

cannot be done across partitions

Many different paths to the same inode, creating a hard link to the file increases the inode count, and deleting a hard link deletes only one of its access paths until the last path is deleted;

Symbolic Links

The data of the linked file points to another file path


The directory can be

Can span partitions

Point to another file path, not an inode


ln [-S] SRC DEST

-s:symbolic Link

-v:verbose


Second, create a 10G file system. Type is EXT4, requires the boot can be automatically mounted to the/mydata directory;

[[Email protected] ~]# fdisk /dev/sdb  device contains neither a  valid DOS partition table, nor Sun, SGI or OSF  Disklabelbuilding a new dos disklabel with disk identifier 0x12b83f86. changes will remain in memory only, until you decide to  Write them. After that, of course, the previous content won ' t be recoverable. warning: invalid flag 0x0000 of partition table 4 will be  Corrected by w (rite) warning: dos-compatible mode is deprecated. it ' s  strongly recommended to         switch off  the mode  (command  ' C ')  and change display units to          sectors  (command  ' u '). command  (m for help):  mcommand action   a   toggle  a bootable flag   b   edit bsd disklabel    c   toggle the dos compatibility flag   d    delete a partition   l   list known partition  Types   m   print this menu   n   add  a new partition   o   create a new empty dos  partition table   p   print the partition table    q   quit without saving changes   s    Create a new empty sun disklabel   t &nbSp; change a partition ' s system id   u   change  display/entry units   v   verify the partition table    w   write table to disk and exit   x    extra functionality  (experts only) command  (m for help): n   //New Partition command action   e   extended   p    primary partition  (1-4) p    //Select Primary partition partition number  (1-4):  1   //First first cylinder  (1-1305, default 1): Using default value  1Last cylinder, +cylinders or +size{K,M,G}  (1-1305, default 1305):  +10g  //divides the size of the 10G value out of range. last cylinder, +cylinders or +size{k,m,g} (1-1305, default 1305):using default value 1305command  (m for help):  w    //Save partition Configuration the partition table has been altered! Calling ioctl ()  to re-read partition table. Syncing disks. [[email protected] ~]# [[email protected] ~]# mkfs -t ext4 /dev/ sdb1   //Format File System mke2fs 1.41.12  (17-may-2010) file System label = Operating system: Linux block Size =4096  (log=2) Chunked size =4096  (log=2) stride=0 blocks, stripe width=0 blocks655360 inodes,  2620595 blocks131029 blocks  (5.00%)  reserved for the super user first block of data = 0maximum filesystem blocks=268435456080 block groups32768 blocks per group,  32768 fragments per group8192 inodes per groupsuperblock backups  stored on blocks:        32768, 98304, 163840, 229376, 294912, 819200, 884736,  1605632 is writing inode table:  complete creating journal  (32768 blocks):  complete writing  superblocks and filesystem accounting information:  Complete This filesystem will  be automatically checked every 29 mounts or180 days, whichever  comes first.  use tune2fs -c or -i to override. [[email protected] ~]#

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/F0/wKioL1XwS8XSERK2AAOGqYLMqrs004.jpg "title=" Untitled. jpg "alt=" wkiol1xws8xserk2aaogqylmqrs004.jpg "/>

[[email protected] ~]# mount-a//Auto mount supported devices [[email protected] ~]# mount//view current mount status/dev/mapper/vg_pizi-logvol03 on/t Ype ext4 (rw) proc On/proc type proc (rw) Sysfs On/sys type SYSFS (rw) devpts on/dev/pts type devpts (rw,gid=5,mode=620) TM PFS On/dev/shm type TMPFS (rw,rootcontext= "System_u:object_r:tmpfs_t:s0")/dev/sda1 on/boot type EXT4 (rw)/dev/mapper/  Vg_pizi-logvol01 on/usr type EXT4 (rw)/dev/mapper/vg_pizi-logvol02 On/var type EXT4 (rw) None On/proc/sys/fs/binfmt_misc Type Binfmt_misc (rw)/dev/sdb1 on/mydata type EXT4 (rw) [[email protected] ~]#


File system Management of Linux Learning

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.