Linux file system swap swap partition and DD command details (3)

Source: Internet
Author: User

Linux file system swap swap partition and DD command details (3)

1. Create swap partition: Partition type 82 is equivalent to virtual memory in Windows

Mkswap/dev/sda5 creating a Swap partition file system region

-L label create label for swap partition

SWAPON/DEV/SDA5 enable the specified swap partition

-A: Enable all swap partitions defined in the/etc/fstab file

-S: View swap partitions

SWAPOFF/DEV/SDA5 closing the specified swap partition

2.free-m viewing physical memory and swap partitions

3.DD command: Convert and copy files

if= Source Path data

of= Target Path data

BS: Specify block size, default unit is byte

Count: Specify the number of blocks

Seek: The size of skipped space, that is, the amount of false capacity created

Example 1: Backing up the MBR master boot record for this hard drive and restoring the/dev/sad

DD IF=/DEV/SDA of=/mnt/usb/sys.mbr Bs=1 count=512

DD if=/mnt/usb/sys.mbr OF=/DEV/SDA bs=512 count=1

Example 2: Creating and adding a swap partition with a file

DD If=/dev/zero of=/root/swapfile bs=1m count=256

Mkswap/root/swapfile

Swapon/root/swapfile

Example 3: Making a disc image

DD If=/dev/cdrom Of=/root/redhat6.iso

4./etc/fstab file is the file system configuration file

Mount mounts the appropriate device and must be written into the/etc/fstab file if it is to be long-lasting, or the machine restart will disappear

That is, each file system defined in the/etc/fstab file is automatically mounted at system startup

The /etc/fstab file format is as follows:

Device mount point to Mount file system type Mount option dump frequency file system detection sequence

/dev/sda5 /soft ext3 defaults 0 0

Dump frequency: Set a full backup number of days, 0 means no backup

File system detection sequence : only the root / can be 1, 0 means no detection

Mount-a: Mount the file system or partition device defined in the/etc/fstab file immediately

5.fuser: Verify the file or socket file that the process is using

-V: View running processes on a file

-K: Kill process, usually in combination with-M

-M: Related to mount file

fuser-km mount point: Terminates all processes that are accessing this mount point

Practice:

1, create a 1G partition, file system for ext3, volume labeled data, block size is 1024, reserve management space for the disk partition of 1%, require boot can automatically mount to the/data directory, it is best to enable label and ACL mount

FDISK/DEV/SDA New Partition/dev/sda5

Mke2fs-j-L data-b 1024-m 1/dev/sda5

Vim/etc/fstab Add the following line

Label= "DATA" /data ext3 defaults,acl 0 0


This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1765618

Linux file system swap swap partition and DD command details (3)

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.