Linux disks and file systems

Source: Internet
Author: User
Tags uuid

DF View Total disk capacity

-I display inodes number

-h Displays the disk size in the appropriate units

-m displays in units of M.

-K Displays the default K display

Du is used to view a directory or the amount of space a file occupies

Parameter:-abckmsh

If you do not add any options and parameters, only the size of the table of contents (including subdirectories) is listed.

-A All files and directory sizes are listed.

Specified units list-b-k-m-h (System Auto-adjust unit)

-C Last Add sum

-s only lists the sum

General use Du-sh

Hard Disk Partitioning tool:

Fdisk

option has only one-l

Fdisk-l the device name will directly list all the disk devices and partition tables in the system, plus the device name lists the partition table of the device

[Email protected] ~]# fdisk-ldisk/dev/sda:17.2 GB, 17179869184 bytes255 heads, + sectors/track, 2088 cylindersunits = Cylinders of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk identifier:0x00018d63   Device Boot      Start         End      Blocks   Id  system/dev/ SDA1   *           1      102400  linuxpartition 1 does not end on cylinder boundary./dev/sda2              13< c13/>274     2097152  swap/solarispartition 2 does not end on cylinder Boundary./dev/sda3             274< c18/>2089    14576640  Linux

If you do not add the option-l

[Email protected] ~]# FDISK/DEV/SDA

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 ').

Enter m to list commonly used commands:

n Add a partition, p establishes the primary partition

When the three primary partitions are divided, the fourth extended partition needs to divide all the remaining disk space into the extended partition, otherwise the remaining space will be wasted, because after dividing the extended partition, partitioning the new partition is divided into the extended partition. Where/DEV/SDB4 is an extended partition, this partition is not formatted, you can think of it as a shell, can be used as a/DEV/SDB5, where/DEV/SDB5 is/DEV/SDB4 sub-partition, this sub-partition is called logical partition

Format a partition of a disk

MKE2FS, Mkfs.ext2, MKFS.EXT3, MKFS.EXT4

MKE2FS Common options are:

The '-B ' partition sets the footprint of each data chunk, and currently supports 1024, 2048, and 4096 bytes per block.

'-I ' sets the size of the Inode

'-n ' sets the number of inode, sometimes using the default inode number is not enough, so you have to set the inode number.

'-C ' before formatting, check the disk for problems, plus this option will be very slow

'-l ' preset label for this partition

The '-t ' is used to specify what type of file system, either ext2, ext3 or EXT4.

Mke2fs-t EXT4/DEV/SDB5

The command is equivalent to mkfs.ext4 /dev/sdb5

Mount/unmount Disk

mount/dev/sdb5/newdir/

/etc/fstab

[[email protected] ~]# cat/etc/fstab##/etc/fstab# Created by Anaconda on Tue May 7 17:51:27 2013## Accessible filesyste MS, by reference, is maintained under '/dev/disk ' # See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) For more I NFO#UUID=95297B81-538D-4D96-870A-DE90255B74F5/EXT4 Defaults 1 1uuid=a593ff68-2db7-4371-8                    D8c-d936898e9ac9/boot ext4 defaults 1 2uuid=ff042a91-b68f-4d64-9759-050c51dc9e8b swap                  Swap defaults 0 0tmpfs/dev/shm tmpfs defaults 0 0devpts   /dev/pts devpts gid=5,mode=620 0 0sysfs/sys Sysfs Defaults 0 0proc/proc proc Defaults 0 0

This file is the individual partitions that need to be mounted when the system starts.
The first column is the identity of the partition, you can write the partition of the label, you can write the partition's UUID, of course, you can write the partition name (/DEV/SDA1);
The second column is the mount point;
The third column is the format of the partition;
The fourth column is some mount parameters of Mount
The number in the fifth column indicates whether the dump was backed up, so this is 1, otherwise it is 0;
The sixth column is the self-test disk at boot time. All means detection, 0 means no detection, in the Redhat/centos, this is also a statement,/partition must be set to 1, and the entire fstab only allow a 1, there is a priority to say. 1:2 priority high, so first detect 1, and then detect 2, if there are multiple partitions need to boot detection then all set to 2 bar, 1 testing will be at the same time to detect 2.

Parameters commonly used in the fourth column:

"Async/sync": Async indicates that it is out of sync with disk and memory, and the system writes memory data to disk at intervals, while sync synchronizes memory and disk data at all times;

"Auto/noauto": Boot automatically mounted/not automatically mounted;

"Default": Set the Mount definition according to the default value of most permanent file systems, it contains RW, suid, dev, exec, auto, nouser, async

"Ro": Mount by read-only permission;

"RW": Mount according to readable writable permission;

"Exec/noexec": Allow/not allow executable file execution, but do not mount the root partition as a noexec, then can not use the system, even mount command can not be used, then only to re-do the system;

"User/nouser": Allow/Do not allow other users to mount the partition outside the root, for security purposes, please use nouser;

"Suid/nosuid": Allow/Disallow partition has suid attribute, general setting nosuid;

"Usrquota": Start the Consumer disk quota mode, disk quota related content in the following chapters will be introduced;

"Grquota": Start the group disk quota mode;

Modify this file yourself to add a row to mount the new partition

Label=test              /newdir                 ext4    defaults        0 0

Umount

Linux disks and file systems

Related Article

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.