Simple partitioning and file systems in the UNIT4 management system

Source: Internet
Author: User
Tags hex code

Simple partitioning and file system ********** in the UNIT4 management system

1. Learning Goals

Add File system space

Add swap swap partition

Read system partition Encryption

2. Commands to view disks

FDISK-L/* Display all available device information in the system

Blkid/* Displays the device ID that the system is using

3. Comparison of file systems

Fs:vfat/ntfs (file system above Windows) Ext (log system 32T) XFS (18eb) file system.

4. Understanding of the system startup process

1)BIOS self-test

BIOS: Also known as the basic input/output system.

2) start the Linux system lit power, the system first to do a BIOS self-test, the main task of the BIOS is to detect the computer peripheral equipment. See if the device can pass the check correctly

Check.

After the completion of the BIOS self-test, according to the starting sequence of the set to determine the operating system by that device to start the computer, the first boot device is usually a hard disk, when the BIOS read to the hard disk startup, will read

First boot the device hard disk first sector--MBR, and then execute the program stored inside. MBR 512=446+64 (62+2), 446 is a saved program that is selected to start the program (the system is made up of

The disk partition to load the boot program, the boot program is loaded elsewhere operating system), that is, the boot grub program, 64 is the partition information, where the last two bytes record disk

A valid flag.

3)dd if=/dev/vdb of=/mnt/data bs=512 count=1

Hexducp-c data (view data stored in the form of files)

As you can see, this is a disk that is recorded by 16 bytes of information, so up to four basic zones (64/16=4), you can record all the remaining space in the last partition, by the last

A partition then divides the logical partition.

4) Grub configuration file in/boot/grub/grub.conf

1. Disk partitioning process

1). Fdisk/dev/vdb

Command (M for help): M

A toggle a bootable flag

b Edit BSD Disklabel

C Toggle the DOS compatibility flag

d Delete a partition/* Delete partition

G Create a new empty GPT partition table

G Create an IRIX (SGI) partition table

L list known partition types/* Lists the partition types available for the system partition

M Print this menu

n Add a new partition/* New partition

o Create a new empty DOS partition table

P Print the partition table/* Display partition

Q Quit without saving changes/* exit

s create a new empty Sun Disklabel

t change a partition ' s system ID/* Modify partition Feature ID

U Change display/entry units

V Verify the partition table

W Write table to disk and exit/* Save changes to partition table

X Extra functionality (experts only)

Command (M for help): N

Partition Type:

P Primary (0 primary, 0 extended, 4 free)/* Partition type Primary partition

e Extended/* partition type is extended partition

Select (default P):/* defaults to Primary partition

Using Default Response P

Partition number (1-4, default 1): 1/* Primary partition ID

First sector (2048-20971519, default 2048):/* This partition start location

Using Default Value 2048

Last sector, +sectors or +size{k,m,g} (2048-20971519, default 20971519): +100m/*

This partition size

Command (M for help): Wq/* Exit Save

Partprobe/* Synchronization partition Table

Cat/proc/partitions/* System all Partitions view

[Email protected] desktop]# Blkid

/dev/vda1:uuid= "9bf6b9f7-92ad-441b-848e-0257cbb883d1" type= "XFS"/*uuid globally unique identity,

MKFS.XFS/DEV/VDB1/* Formatted with XFS System file type

2.swap swap partition: The swap space or swap area is space on the disk drive and is used as a memory overflow for the currently unused portion.

File:/run/media/kiosk/ca9c-5ce5/11.11/11.5 (1) Page 3 of 3

SWAPON-A/* Will activate the new swap area

Swapon-s/* Displays the status of the current swap area

Swapoff/dev/vdan/* Will deactivate the specific swap area

[Email protected] desktop]# FDISK/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 help): N

Partition Type:

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

E Extended

Select (default P):

Using Default Response P

Partition number (3,4, default 3):

First sector (411648-20971519, default 411648):

Using Default Value 411648

Last sector, +sectors or +size{k,m,g} (411648-20971519, default 20971519): 100M

Command (M for help): t/* Modify partition type

Partition number (1-3, default 3):

Hex code (type L to list all codes): 82/* modified to swap type

Changed type of partition ' Linux ' to ' Linux Swap/solaris '

Command (M for help): Wq

Mkswap/dev/vdb3

Swapon-a/DEV/VDB3

Swapon-s/dev/vdb3-p 1/* Specify level

3) boot up

Vim/etc/fstab/* Add new swap space to/etc/fstab for boot-up

/DEV/VDB3 (UUID can also) swap swap defaults 0 0

/dev/vdb1/mnt XFS Defaults 0 0

4) can intercept an existing empty file, as a partition

DD If=/dev/zero OF=/MNT/SWAPFILE|WESTOS1 bs=1m count=1000

Mkfs.xfs/mnt/swapfile

Mkswap/mnt/westos1

3. Disk Encryption

1) FDISK/DEV/VDB/* New partition

Cryptsetup LUKSFORMAT/DEV/VDB1/* Partition encryption

Note: Enter uppercase Yes

[Email protected] desktop]# Cryptsetup LUKSFORMAT/DEV/VDB1

warning!

========

This would overwrite data on/dev/vdb1 irrevocably.

Is you sure? (Type uppercase Yes): Yes

Cryptsetup OPEN/DEV/VDB1 Westos

Mkfs.xfs/dev/mapper/westos

mount/dev/mapper/westos/mnt/

umount/mnt/

Cryptsetup Close Westos

It is different to write a file after you mount the partition and mount the partition first!!!

Write the file first, then the file under the original directory, and then mount it, the file will not be visible, because the entry is not the same partition

2) Permanent mount of encrypted disk

Vim/etc/crypttab

Decryption Device management file device encryption character store file

Redhat/dev/vdb1/root/lukspsfile

Vim/root/likspsfile

Password:

chmod 600/root/lukspsfile/* Only root can be opened

Crytsetup luksaddkey/dev/vdb1/root/lukspsfile/* Give the key to the encrypted disk

Vim/etc/fstab

/dev/mapper/redhat/mnt XFS Defaults 0 0

Reboot

3). Encryption Erase

Vim/etc/fstab

>/etc/crypttab

Rm-fr/root/lukspsfile

umount/mnt/

Cryptsetup Close Redhat

Mkfs.xfs/dev/vdb1

4. Disk array (barrel principle) FD/* For faster read and write, multiple disks read together, turns to write relatively fast

Fdisk/dev/vdb

Mdadm-c/dev/md0-a yes-l 1-n 2-x 1/dev/vdb{1..3} (-a no/dev/md0 auto-build,-l level,-N several devices,-X idle few

Block

Mkfs.xfs/dev/md0

mount/dev/md0/mnt/

Watch-n 1 Cat/proc/mdstat

Mdadm-f/DEV/MD0/DEV/VDB1/* Hang off VDB1

mdadm-d/dev/md0/* Displays the status of the disks inside the MD0

Mdadm-r/DEV/MD0/DEV/VDB1/* Delete the VDB1 disk inside the MD0

Mdsdm-a/DEV/MD0/DEV/VDB1/* load VDB1 to md0 again

umount/mnt//* Uninstall

Mdadm-s/dev/md0/* Turn off disk array

5. Quotas (limit the size of other users writing to files)

Fdisk/dev/vdb

Mkdir/pub

Mkfs.xfs-f/DEV/VDB1

Mount-o usrquota/dev/vdb1/pub/* Mount with user mates

chmod 1777/pub

QUOTAON-UV/DEV/VDB1/* Display user quotas

Edquota-u Student/* Edit user quotas

Su-student

hard:20000 (k)

Test exceeds quota, file will be deleted by system seven days later

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


Simple partitioning and file systems in the UNIT4 management system

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.