Linux rookie 2 device partitioning and Disk Management

Source: Internet
Author: User

Unit four device partitioning and Disk Management


Partitioning method

FDISK/DEV/VDB Division Command/dev/vdb

Welcome to Fdisk (Util-linux 2.23.2).

Changes'll remain in memory only, until the decide to write them.

Be careful before using the Write command.

Command (M for assist): M get help

Command Action

A toggle a bootable flag

b Edit BSD Disklabel set device label

C Toggle the DOS compatibility flag

d Delete a partition remove device

G Create a new empty GPT partition table

G Create an IRIX (SGI) partition table

L list known partition types list device types

M Print this menu

n Add a new partition newly created partition

o Create a new empty DOS partition table

P Print the partition table show partitioned tables

Q Quit without saving changes exit partition tool

s create a new empty Sun Disklabel

t change a partition ' s system ID changes the partition function label

U Change display/entry units

V Verify the partition table

W Write table to disk and exit save changed partition table

X Extra functionality (experts only)


Partition type:p Specifies the partition type that divides the device

P Primary (0 primary, 0 extended, 4 free)

E Extended

Partition number (1-4, default 1): 1 specifies the partition table numbers to use

First sector (2048-20971519, default 2048): Enter partition start fast, select default

Using Default Value 2048

Last sector, +sectors or +size{k,m,g} (2048-20971519, default 20971519): +1G Device size designation

Command (M for help): P Display partition table

/DEV/VDB1 2048 2099199 1048576 The partition that was partitioned by Linux

Command (M for help): Wq save change mode and exit

Partprobe Synchronization Partition Table

Cat/proc/partitions to see which partitions the system recognizes


Using the newly created partition

Format (format the file system in the partition device)

Mount

Vim/etc/fstab Permanent Mount

Device Removal

Unloading

To delete an auto-mount entry for a device in/etc/fstab

Delete a partition with Fdisk

management of swap partitions

Swapon-s viewing swap partitions in the system

Creating a Swap partition

MKSWAP/DEV/VDB1 format the/DEV/VDB1 into swap format

Swapon-a/DEV/VDB1 Activation

Vim/etc/fstab Boot automatic activation

/DEV/VDB1 Swap defautls 0 0

Delete a swap auto-activation entry in/etc/fstab

SWAPOFF/DEV/VDB1 to close the active swap partition

Disk Encryption

1. Disk Encryption

FDISK/DEV/VDB partition

Cryptsetup LUKSFORMAT/DEV/VDB1 Encryption

Cryptsetup open/dev/vdb1 Westos Open

Mkfs.xfs/dev/mapper/westos formatting

mount/dev/mapper/westos/mnt/Mount

umount/mnt/Uninstall

Cryptsetup Close Westos exit

2. Permanent Mount of encrypted disks

Vim/etc/cryppttabb decryption after Device management file device encryption character storage file

Redhat/dev/vdb1/root/lukspsfile

Vim/root/lukspsfile Zhonghaoxuan

chmod 600/root/lukspsfile

Cryptsetup Luksaddkey/dev/vdb1/root/lukspsfile to associate a password record file with a device

Vim/etc/fstab

/DEV/MAPPER/REDHAT/MNTXFSDEFAULTS0 0 Automatic Mount encryption device

Reboot

3. Encryption Erase

Vim/etc/fstab

>/etc/crypttab

Rem-fr/root/lukspsfile

umount/mnt/

Cryptsetup Close Redhat

Mkfs.xfs/dev/vdb1

Df

Disk Array

fdisk/dev/vdb# #划分三个分区

Mdadm-c/dev/md0-a yes-l 1-n 2-x 1/dev/vdb{1..3}

Create a block of unused disk blocks that are used by the new level if not

mkfs.xfs/dev/md0 formatting

mount/dev/md0/mnt/Mount

Watch-n 1 Cat/proc/mdstat Monitoring command

Mdadm-f/DEV/MD0/DEV/VDB1 Stop

mdadm-d/dev/md0 View Status

Mdadm-r/DEV/MD0/DEV/VDB1 Delete

Mdadm-a/DEV/MD0/DEV/VDB1 New

umount/mnt/Uninstall

Mdadm-s/dev/md0 stop using (unload and execute-s when only one partition is saved)

Quotas

Fdisk/dev/vdb New VDB1

Mkfs.xfs/dev/vdb1

Mkdir/pub New Directory

chmod 1777/pub Set/pub permissions

Mount-o Usrquota/dev/vdb1/pub Mount

Quotaon-uv/dev/vdb1

Edquota-u Student Settings


DD If=/dev/zero of=/pub/file bs=1m count=500 divided out

Quota View


This article from the "12147236" blog, reproduced please contact the author!

Linux rookie 2 device partitioning and Disk Management

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.