Linux Operations Phase II (VI) file system Management

Source: Internet
Author: User
Tags disk defragmenter

Linux Operations Phase II (vi) file System Management

First, hard disk:

Logical Structure: Sector sectors(minimum storage unit of disk), track, cylinder cylinders;

hard disk Size: number of Heads * Number of cylinders * Number of sectors * size of each sector

Note: The number of cylinders indicates that there are several tracks on each platter of the hard disk, and the number of sectors indicates that there are several sectors on each track

Second, the file system:

Super Block (superblock) records information about the entire file system, including the total number of blocks and inode , used, unused, file system mount time, last write time, Last disk test time;

Data Block (DataBlock) is used to actually save the data,block size (1K,2K,4K) and quantity are determined after formatting and cannot be changed , unless reformatted; if the file data is less than one block, the remaining space cannot be occupied by other files, and if the data is larger than one block, it occupies multiple blocks. The Disk Defragmenter tool in Windows is to put together as many blocks as possible to conquer a file, which speeds up reading and writing.

Iii. Common Disk Management commands

"#df-aht ( statistics partition occupancy, statistical partition of the remaining space is accurate )

-A ( displays special file systems, almost all in memory /proc so occupancy is 0)

-H (human-readable,k,M,G)

-T ( more than one column of the file system type )

"#du-a|-h|-s directory or file name ( statistical file size is accurate )

- A (displays the disk footprint of each file, by default only the disk footprint of the subdirectory is counted )

-S (Summary total usage, not sub-directories and sub-file usage)

"#lsof | grep deleted ( view the deleted file and then a process manually Kill)

"#fsck-y/dev/sdb1 ( automatic repair, boot automatic execution, and lost+found under each partition )

"#dumpe2fs/dev/sda2 ( displays disk status, can view disk UUID, etc. )

"#stat file name ( view file details time )

#file file name ( determine file type )

"#type command name ( judging command type )

iv. Manual Partitioning of fdisk:

#fdisk-L ( View all hard disk partitions on the system)

#fdisk/dev/sdb ( for disk partitioning )

Command (Mfor Help): m/n/p/d/q/w ( Common Interactive instruction, remember W save after sorting well )

#partprobe ( perform this command without restarting, forcing reread of all partition files, re-mounting partitions )

#mkfs-T EXT4/DEV/SDB1 ( format, build file system )

#mke2fs-T|-B|-I|-J|-L/DEV/SDB1 ( formatted, adjustable partition default parameters )

-B ( specify block size )

-I (Specify the ratio of bytes/inode, how many bytes are allocated 1 inode)

-j ( establish file system with ext3 log function )

-L ( set the volume label name for the filesystem, there is no e2label setting )

#mount/dev/sdb1/disk1 ( Mount )

#fdisk-L

#df

#vi/etc/fstab ( carefully modify this file, if there is an error system will not start )

/dev/sdb1/disk EXT4 Defaults 1 2 ( 1 to 6 of the following in turn)

1.Device file name: This item can also use the UUID(universallyunique Identifier) Universal Unique identification code, the advantage: when the hard disk added new partitions or the order of the partition changes, Kernel upgrade can still ensure the correct loading of partitions, without causing the boot barrier;

#ll-L/dev/disk/by-uuid/( view disk uuid)

#dumpe2fs/dev/sdb1 ( view disk UUID)

2, Mount point

3. File System

4.mount option, example:defaults,acl or Defaults,usrquota,grpquota

5, whether can be backed up,0 not backup,1 daily Backup,2 unscheduled backup

6, whether to detect the disk,0 does not detect,1 start-up detection,2 after boot detection

#mount- A (test for correct/etc/fstab, re-mount all content )

Five,/etc/fstab file Repair:

Enter root password #mount-o remount,rw/-#vi/etc/fstab

Six,parted command partition: Partition table two:MBR and GPT

MBR(master Bootrecord) master boot Record partition table, supported maximum partition 2TB, supports up to 4 primary partitions (3 primary partitions 1 Extended partitions)

GPT(guidpartition table) Globally uniquely identifies the partition table, supporting a maximum partition of 18EB(1EB=1024PB;1PB= 1024TB), up to a maximum of 1 partitions, of which the system retains partitions,127 user-defined partitions

Note:The parted command can only be formatted as ext2, but it recognizes EXT4and can be formatted as EXT4 in the system

#parted/dev/sdb

(parted) Print/mklabel Gpt/mkpart/mkfs/resize/rm ( Common Interactive commands )

#parted-L ( view partition )

Note: Multiple partitions when end is -1 represents to the end of the disk

vii. allocation of swap partitions

#fdisk/DEV/SDC

Command (M for help) T ( Modify the partition system ID)

(In the region of the swap partition, which is Linux)

#mkswap/DEV/SDC1 ( formatted )

#swapon/DEV/SDC1 ( activates the swap function for this partition )

#swapoff/DEV/SDC1 ( turn off the swap function for this partition )

#free ( view memory status )

Auto-mount swap on boot:

#vi/etc/fstab

/DEV/SDC1 Swap swap Defaults 1 2

From Brother Lian Training

This article is from the "Linux Operational Difficulty Learning notes" blog, please be sure to keep this source http://jowin.blog.51cto.com/10090021/1641501

Linux Operations Phase II (VI) file system Management

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.