Linux mount command, swap partition, DD command

Source: Internet
Author: User
Tags uuid

Mount: Place the current root file system on the new file system management.

Uninstall: To remove a file system from the current root file love your system's associated relationship.


#mount [OPTION] DEVICE Mount_point

Mounted devices are device and mount points are mount_point.

Displays all current mounts without parameters.

When you are finished, you will be asked to access the file on the corresponding file system via the mount point.


DEVICE

Device file:/dev/device

Volume label; label= ""

Uuid:uuid= ""


Mount_point

Requirements:

1. This directory is not used by other processes.

2. The catalogue needs to exist beforehand.

3. The original files in the catalogue will be temporarily concealed.



[OPTION]

-A means to mount all the file systems defined in the/etc/fstab file.


-R read-only mount. Equivalent to-o ro.


-W read-write Mount. Equivalent to-o RW


-N is not written to/etc/mtab when mounted. By default, the Mount command saves the mounted device information to the/etc/mtab file for each device mounted.


-T fstype specifies the file system type of the mounted device. By default, this option is not used, and Mount calls the Blkid command to get the corresponding file type.


-o Specifies the properties to access the mounted device. Multiple parameters are separated with commas.


The Defualts parameter is used by default without specifying parameters, Defualts=rw+suid+dev+exec+auto+nouser+async.


Rw/ro read/write/Read Only


Suid/nosuid whether file special permissions are enabled.


Dev/nodev whether to enable device node files for group devices (block device), Word element devices (char device) on this file system.


Exec/noexec whether execution files on the file system are allowed to execute.


Auto/noauto whether the-a option is enabled when mounting.


User/nouser whether to allow ordinary users to mount the uninstall device, the default is not to allow ordinary users to mount.


Async/sync

Async, writes asynchronously, writes memory first, then the kernel dispatches, and then writes to disk. High IO efficiency.


Sync, write synchronously, and any time the data is written to disk immediately. resulting in reduced system performance.


_netdev Network disk Mapping. When this option is used, it is skipped automatically if the network is not available. By default, if the specified file device is mounted, the system waits until the file is mounted before continuing to start.


Owner allows normal user to mount.


Remount re-mount.

You can use this option without unloading the mount, and rather update the mount parameters.


Atime/noatime the access timestamp of the file when the file is updated (Access time)


Loop to mount the local loopback device.



#umount[OPTION] device| Mount_point

Uninstall the device.

When it fails to unload properly, use the Fuser command to view and kill the files and processes that are occupied.

Precautions:

1. The mounted device is not in process use.


[OPTION]

-A uninstall all mounts

-R If uninstallation fails, the Mount option is changed to RO

-V Show More information

-T Fstype uninstalls the specified file system type.


#fuser [OPTION] mount_point| device| FILENAME

Validates the file or socket that the process is using.


[OPTION]

-V displays detailed information.

-K FILENAME kills the process that is currently accessing the file. Usually used with-M.

-M mounts the files on the device.


/etc/fstab

The system partition mounts the table and automatically loads the partitions in the file when the system starts.

The format is as follows:

1.DEVICE can use Device,label_name,uuid and so on.


2.mount_point mount point.


3.FSTYPE file system type.


4.mount_option mount option, multiple options can be separated by commas.


5.dump_freq the frequency of full backups:

0 never back up.

1 do a full backup every day.

2 Make a full backup every 1 days.


6.fsck_order File System Detection order: 0-9,0 (not detected), the same serial number parallel detection. The root file system can only be marked as 1!.


The/etc/mtab holds the current system Mount state.

The format is as follows:

DEVICE on Mount_point type Fstype (Mount_opiton)


The 1.DEVICE mount device name, if none, indicates that the device is not an entity's disk space.


2.moutn_point mount point.


3.FSTYPE file system type.


4.moutn_option mount option.




Swap partition (Swap):

To create a partition:

#mkswap [OPTION] DEVICE

[OPTION]

-L LABEL

Use Fdiks to adjust the partition type to 82 before using this command.


To turn swap partitions on and off:

#swapon [OPTION] DEVICE

[OPTION]

-a enables the switching device defined in the/etc/fstab file.


#swapoff DEVICE




#free [OPTION] To view the use of physical memory and swap space in the system.

[OPTION]

-M displays the size in m units. The default is K



DD command

The difference between DD and CP: DD is a block-bound copy, and CP is a copy of the file interface. DD than CP for the system, DD is at the bottom of the system. DD is a copy of the data source in the original format (raw data) to the destination. The CP is rearranged by the data format of the destination.

#dd [OPTION] if=source of=destioation bs=block_size seek=jumpsapce count=sum

[OPTION]

Sources of source data.

Destioation the target of data outflow.

Block_size The block size of each copy.

Jumpspace The amount of space to skip when creating a file.

SUM copies the number of block blocks altogether.


For example:

To back up and restore MBR partition information:

To back up the MBR partition:

#dd IF=/DEV/SDA of=/root/mbr.backup bs=2 count=256

To restore an MBR partition:

#dd if=/root/mbr.backup OF=/DEV/SDA bs=512 count=1


To create swap files on disk:

#dd If=/dev/zero of=/tmp/swapfile bs=1m count=1024

#swapon/tmp/swapfile


This article is from "Small Private blog" blog, please be sure to keep this source http://ggvylf.blog.51cto.com/784661/1606046

Linux mount command, swap partition, DD command

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.