Disk and File System Management (II)

Source: Internet
Author: User

I. File system

1. You cannot create a file system on a partition that already has files that can corrupt an existing file

2. Create a file system on a partition

A.cat/proc/filesystems View the file system types supported by the current kernel

B.cat/proc/partitions View all partition information for the current system

C.MKFS command--Create a file system

Mkfs-t Ext3/dev/sda5

-T: Specify File system type

Mkfs-t ext2 = mkfs.ext2

Specialized in managing EXT series files:

Mke2fs

-j: Create ext3 Type file system (default to create Ext2 file system)

-B block_size: Specifies the block size, default is 4096; available values are 1024, 2048, or 4096

-L LABEL: Specifies the partition volume label (partition name)

-M #: Specifies the percentage of blocks reserved for super users

-I #: 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 Inode Count

-F: Force a file system to be created (for cases where the file system is already mounted)

-E: User Specifies additional file system properties

Blkid: Querying or viewing related properties of disk devices

Usage: Blkid/dev/sda3

UUID: A uniform global identifier

Type: File system types

Label: The volume label of the partition

E2label: Used to view or define volume labels

E2label device File View Volume label

E2label device File volume label set volume label

TUNE2FS: Adjust file system related properties (created file system can no longer resize blocks)

-j: Upgrade ext2 to ext3 without compromising the original data

-L LABEL: Set or modify volume label

-M #: adjust reserve percentage

-R #: Specify the number of reserved blocks

-O: Set default mount Options

ACL functionality

-C #: Specify the number of mounts to # times after the self-test, 0 or 1 tables turn off this feature

-I #: self-Test on how many days each mount is used; 0 or 1 means turn off this feature

-L: Displays information in the Super block

DUMPE2FS: Displaying file system Property information

-H: Show only information in the Super block

Fsck: Checking and repairing the Linux file system

-T Fstype: Specifying the file system type

-A: Automatic repair

E2FSCK: Dedicated to repairing Ext2/ext3 file system

-F: Forced check

-P: Automatic repair

3. Mount: Associate a new file system to the current root file system

Uninstall: Pre-Remove a file system's association with the current root file system

When the mount is complete, the files on the corresponding file system are accessed via the mount point

Create a new directory under the/mnt/directory for the file system mount point (there will be a lost+found directory under the Mount directory)

Mount: Mount

Usage: Mount device mount point

Equipment:

Device file:/dev/sda5

Volume Label: label= ""

Uuid:uuid= ""

mount point: Directory

Requirements:

1. This directory is not used by other processes

2. The catalogue must exist beforehand

3, the original files in the directory will be temporarily hidden

Mount: Displays devices and mount points that are already mounted on the current system

mount [Options] [-o options] DEVICE mount_point

Command options Mount file system feature options

-A: Indicates that all file systems defined in the/etc/fstab file are mounted

-N: By default, the Mount command saves the mounted device information to the/etc/mtab file each time a device is mounted, and using the-N option means that the information is not written to the file when the device is mounted

-T Fstype: Specifies the type of file system on which the device is being mounted; When this option is not used, Mount invokes the Blkid command to obtain the type of the corresponding file system

-R: Read-only mount, Mount disc often with this option

-W: Read-write Mount

-O: Specify additional mount options, that is, specify the properties that the file system enables

Remount: Re-mount the current file system

RO: Mount as read-only

RW: Read-write Mount

Umount: Uninstalling a file system

Umount Equipment

Umount mount point

Uninstall considerations:

The mounted device is not in process use (not in a directory that needs to be mounted)

Practice:

1, create a 2G partition, the file system is ext2, the volume is labeled data, the block size is 1024, the reserved management space for the disk partition of 8%, mounted to the/backup directory, requires the use of the volume label to mount, and on the mount to start the ACL function on this file system

# mke2fs-l Data-b 1024-m 8/dev/sda7

# mount-o ACL Label=data/backup

# Tune2fs-o ACL/DEV/SDA7

# Mount Label=data/backup


2. Save the block and Inode rows from the information in the super block of this file system to/tmp/partition.txt

# Tune2fs-l | Egrep-i "Block|inode" >>/tmp/partition.txt


3, copy all the files in/etc directory to this file system, and then adjust this file system type is ext3, the request cannot damage the files that have been copied

# cp-r/etc/*/backup

# tune2-j/dev/sda7


4. Adjust its reserved percentage to 3%

# tune2fs-m 3-l Data/dev/sda7


5. Mount this file system in a re-mount mode to not update the access timestamp and verify its effect

# Stat/backup/inittab

# Cat/backup/inittab

# Stat

# Mount-o Remount,noatime/backup

# Cat

# Stat


6, the file system forced to do a test

# e2fsck-f/DEV/SDA7


7, delete all the copied files and re-mount the file system as sync (sync), and then copy all the files in the/etc directory to this mount point to experience its performance changes

# rm-rf/backup/*

# Mount-o Remount,sync/backup

# cp-r/etc/*/backup






This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1641812

Disk and File System Management (II)

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.