Linux Learning Notes (15) disk format, disk mount, manually increase swap space

Source: Internet
Author: User
Tags memory usage uuid

First, disk format
cat /etc/filesystems


View the file formats supported by the system

mount


View the file format of the system
You can see the root directory and, boot are XFS formats
CENTOS6 is using EXT4.
Ext3 used by centos5
Before it was ext2.

Mke2fs
-t specifies the file format ext4, ext3
-b Specifies the block size, when the file is larger, the block can be larger, such as video, high-definition pictures
Compare hours to make the block smaller and speed up reading
-m specifies the amount of space reserved for the root user, 1 is 1%,0.1 is 0.1%
-i specifies how many bytes occupy an inode number
If you do not specify the-t file format, the default is ext2 format

Mkfs.xfs-f

mkfs.ext4  

Format a partition as EXT4 format

mkfs.xfs   -f /dev/sdb1

Format a partition in XFS format

A partition can be queried using mount only if it is mounted, and partitions that are not mounted can be

blkid /dev/sdb1


Parameter instance

MKFS.EXT4 = = Mke2fs-t Ext4

MKFS.EXT4 supports the same options as Mke2fs
XFS format can only be created with MKFS.XFS

Second, disk mount

You can format the partition, regardless of partition, only after formatting

mount /dev/sdb  /mnt/

Attach the/dev/sdb to the MNT

It can also be used here

mount UUID="2d8e7749-f2f7-4de5-b1b9-b6bf758d2f37"  /mnt/

The UUID here is found in Blkid/dev/sdb.
df -h
can see already mounted

Unmount disk

umount  /dev/sdb  

If the current directory is under/DEV/SDB, you need to exit the current partition
can also be used directly

umount  -l /dev/sdb  

Or

umount  -l /mnt/

That is, when you unmount the disk, you can follow the disk name, or you can umount with the mount point, the same effect

man mount

You can see the specific usage of Mount
/defaults can find the default usage
Find the following line
Use default OPTIONS:RW, suid, Dev, exec, auto, Nouser, and async.
RW Read and Write permissions
Suid can set SUID permissions
Dev, the system does not have to be managed by default
EXEC executable
Auto Mount automatically
Nouser allow normal user to mount, default does not allow
Async does not synchronize memory in real-time with something to disk (reduces disk pressure)

mount -o remount,rw  /dev/sdb

Re-mount

vi  /etc/fstab

Which files are mounted on the system boot

Add the newly mounted disk and automatically mount the boot

Third, manually increase the virtual memory

First of all
Create a virtual disk

dd if=/dev/zero of=/tmp/newdisk  bs=1M count=100


If specified source, general write/dev/zero, it is a UNIX system-specific file, you can continuously provide ' 0 ', of the specified target file, BS specify the block size, count the number of specified blocks


Format to swap
mkswap -f /tmp/newdisk
The new swap is loaded

swapon  /tmp/newdisk

Show memory usage size,-m specifies unit m

swapoff  /tmp/newdisk

To unload virtual memory

Linux Learning Notes (15) disk format, disk mount, manually increase swap space

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.