Learning Log---Mounting of linux disk partitions

Source: Internet
Author: User
Tags uuid

Mount Management:


GPT Partitioning mechanism:

When a single hard disk exceeds 2T, the MBR partition mechanism is out of order, using the GPT partition mechanism

SSD: Solid State Drive

Electrical hard drive, very good working characteristics


Partition: Fdisk,

Formatting: Creating a file system


Hdparm

-I view disk information

-I.

-G Display Disk layout information

-T View disk performance

-T


/proc/partitions Partition information

/proc/meminfo Current Kernel memory usage

/proc/filesystems file system Information that the current kernel has identified

[Email protected] ~]# Cat/proc/filesystems

Nodev Sysfs

Nodev Rootfs

Nodev Bdev

Nodev proc

Nodev Cgroup

Nodev Cpuset

Nodev TMPFS

Nodev DEVTMPFS

Nodev Binfmt_misc

Nodev Debugfs

Nodev SECURITYFS

Nodev SOCKFS

Nodev USBFS

Nodev Pipefs

Nodev Anon_inodefs

Nodev INOTIFYFS

Nodev devpts

Nodev Ramfs

Nodev HUGETLBFS

iso9660

Nodev Pstore

Nodev Mqueue

Ext4

The Nodev refers to the absence of this device, which means that the subsequent file system corresponds to a virtualized device, which can be used by a generic file system


To use a new partition after formatting, you need to associate the current partition with the free directory on the root partition as the access entry.

Only the partition on which the root file system resides is loaded when the kernel is first started


Mount:

To mount manually:

Mount on Demand:

Automatic mount on Boot:



mount [Options] [-t fstype] [-o-option] device mount point

[Options]: Option for commands

-O options: Enable partition feature on Mount


Mount point: The original data will be temporarily hidden;

A mount point is a directory of root partitions where data files are transferred to mounted devices

If a point is repeatedly mounted, the data of the original mounted device is temporarily hidden

Therefore, the mount requires:

1, option idle path;

2, prior to existence;


Unloading:

1, can be unloaded when idle;

We generally access the/bin,/usr directories are on the root partition of the file system, if you mount other devices, you need to create a new directory under the root, such as/mydata, can be mounted


Mount: Direct use to display all mounted devices of the current system

[email protected] ~]# mount

/dev/mapper/vg_steiss-lv_root on/type ext4 (rw)

Device name on (Mount)/is mount to where type Ext4 mount feature (RW read/write)

Proc On/proc type proc (rw)

The virtual device is just like Proc.

Sysfs On/sys type SYSFS (rw)

Devpts on/dev/pts type devpts (rw,gid=5,mode=620)

Tmpfs ON/DEV/SHM type TMPFS (rw)

/DEV/SDA1 on/boot type EXT4 (rw)

This indicates that the SDA1 partition is mounted to the/boot directory

None On/proc/sys/fs/binfmt_misc type Binfmt_misc (rw)

This information is obtained from/proc/mounts, which is the current mount information, Proc is the current relevant information of the kernel

/proc/mounts current mount information maintained by the kernel

/etc/mtab mount table, also used to track the current mounted device files


Common options:

-T Fstype

-R: Read-only Mount

-W: Read and Write

-L lable: specified as volume label, lable= "label"

Mount-l Mydata/mydata mount the partition labeled MyData to/mydata

-U UUID: Mount device specified with UUID, uuid= "UUID"

-A: Automatically mount all (in/etc/fstab files) devices that support automatic mounting


If the current/dev/sda3 mount to/mydata, put some files into the MyData directory, then the file information and file data into the device, after unloading, in the MyData directory can not find these files. If you mount the device to another directory again, the previously placed file will still be found. Which device you mount to, then the file under the device will be mapped to the mount point directory, we can access through this point.

Create a new directory under the root directory to mount the other partitions.

After partitioning and formatting the disk, the device files corresponding to the disk are set up, and the kernel is then allowed to identify and process the operations of the disk partitions.


-O options (option to set mount properties) can be viewed with man mount, with multiple options separated by commas

Async: Asynchronous I/O, data writes are now in memory operation and then written to disk, so as to improve performance

Sync: Synchronous I/O, reliable, but low performance

Noatime/atime: Recommended Noatime, do not update the timestamp of file access

Auto/noauto: Can be automatically mounted by the MOUNT-A option;

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

Exec/noexec: Whether the binary program is allowed to execute;

_netdev: Sometimes you specify an automatically mounted device in the fstab, if it is a network device, but the network does not start, it will mount the failure and keep trying, if you use this option, the

When there is no network, it will stop until the network is restored.

Remount: Re-mount

Mount-o Remount,ro/dev/sda3 can only specify mount point when re-mount

ACL: Enable Facl (File access control list)

If you do not specify the-o option, the following default property is used

Defaults

Use default OPTIONS:RW (read/write), suid, dev (allow device files), exec (allow binary execution), auto (allow auto mount to complete), Nouser, async, and Relatime (real-time).


# Tune2fs-o Mount-option device can set the device's Mount default properties

# tune2fs-o ^mount-option Cancel the device's mount default properties can be canceled


CD: is also a device file, the kernel is recognized as/dev/cdrom this device file, can be mounted, mount when the file system type is iso9660

/dev/cdrom,/dev/dvd,/dev/sr0

[-t iso9660]


To view the processes that occupy the mounted device:

fuser-v mount point to see which user processes are currently accessed by this mount point

fuser-km mount points can kill the process that accesses the device


Umount Equipment | mount point


DF: Disk space Usage status report, direct use is to view data

-h:human-readable

-i:inode viewing the usage of inode

-p:posix


DF [Options] [device]


[[email protected] boot]# df-h/sbin This command to see the current file on which partition

Filesystem Size used Avail use% mounted on

/dev/mapper/vg_steiss-lv_root 6.7G 837M 5.5G 14%/


Du: Evaluation of disk space usage

-S

-H



Automatic mount on Boot:

/etc/rc.d/rc.sysinit: System Initialization script

One of the features: Mount the file system Mount table defined in the/etc/fstab file

#

#/etc/fstab

# Created by Anaconda on Wed Feb 12 09:48:07 2014

#

# Accessible filesystems, by reference, is maintained under '/dev/disk '

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

#

/dev/mapper/vg0-root /ext4 Defaults 1 1

Uuid=958ea5da-eafc-4311-8609-1e97fe11e6f9/boot EXT4 Defaults 1 2

/dev/mapper/vg0-usr /usr ext4 defaults 1 2

/dev/mapper/vg0-var /var ext4 defaults 1 2

/dev/mapper/vg0-swap swap swap defaults 0 0

TMPFS/DEV/SHM TMPFS Defaults 0 0

Devpts/dev/pts devpts gid=5,mode=620 0 0

Sysfs/sys Sysfs Defaults 0 0

PROC/PROC proc Defaults 0 0


When the system starts, it only mounts the root partition to the root and then mounts the other, where the root partition is the logical volume/dev/mapper/vg0-root for easy management

The root partition is managed by a logical volume

SDA1 partition mounted to/boot to store the kernel

Devices to mount: device files, label=, uuid=

Mount point: Swap has no mount point and the mount point is swap

File system type

Mount options: Commas are used between multiple options;

Dump frequency:

0: Never Back up

1: Daily backup

2:

Self-Test order:

0: No self-test

1: First self-test, usually can only be/used;

2:



Swap partition:

Linux uses memory mechanism:/proc/sys/vm/swapiness


How big is good:

2G to 4G in physics, can set 4G swap partition

Physical memory less than 2G, setting the physical memory

Greater than 8G, setting 4G can


Mkswap (can be set to swap partition for a logical partition), Swapon, Swapoff


To view the memory space usage status:

# Cat/proc/meminfo

# free

-M: Display results in megabytes

-G: Display results in gigabytes

[email protected] boot]# free-m

Total used free shared buffers Cached

MEM:1006 350 655 0 89 222

-/+ buffers/cache:39 966

swap:815 0 815

Note: Buffers is a buffer that improves write performance; Cached is a cache that improves read performance.


DD command: Can copy, can detect the file system, but also create a loopback device

DD if=input_file of=output_file Copy lower-level copy instructions, bypassing file systems, copying file blocks directly

DD if=input_file of=output_file Bs=#[b|k|m|g] count=#

BS can specify how large a copy is, count specifies how many times it is replicated, and this also has to be a BS copy several times


DD If=/dev/cdrom Of=/tmp/linux.iso

Cat/dev/cdrom >/tmp/linux.iso

The above two commands can be used to create a mirror


DD IF=/DEV/SDA of=/tmp/myfile bs=512 count=1

The first 512 bytes of a hard disk refer to the MBR, which can back up the MBR


DD If=/dev/zero of=/dev/sdb bs=500 count=1


/dev/zero This is how much it will take 0 to spit out 0

/dev/null


Summary: Mount, Umount, fuser, free, Du, DF, DD


Learning Log---Mounting of linux disk partitions

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.