Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Disk management in linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Why manage disks?

1. Storage is the basic requirement of every computer system.

Red Hat Linux provides powerful tools to manage multiple types of storage devices in a large number of scenarios.

two。 Disk management is a routine task when a computer is used, and it is provided to users in the form of a set of disk management applications.

They are located in the computer Management console and include error checkers and disk defragmenters as well as disk defragmenters.

two。 Disk partition

Mbr

Basics:

Master boot mbr: it tells the head to read the information about disk c. The main boot is in the first sector of track 0.

Mbr (dos) single partition size cannot exceed 2t, it includes primary partition + extended partition, the total number should be less than or equal to 16.

An extended partition is a container containing logical partitions, and when the extended partition (container) is damaged, the contents will also be damaged. The location of the extended partition container in the fourth partition.

Gpt partition can be divided into up to 128partition

two。 Step fdisk / dev/vda

Parameter description: d delete a partition

N New partition

P display partition information

Q exit the partition interface

T modify partition id, change partition type

W save partition table information to hard disk

3. Finally, remember that partprobe synchronizes the partition table, otherwise the data you are supposed to have will not be synchronized.

Gtk

1.parted equipment

2.mklabel gpt

3. The next steps are similar

Establishment of 3.swap partition

1. Partition and set up a partition id of 82

2.mkswap / dev/vdb6

3.swapon-a / dev/vdb1

4.swapon-s

5. Permanently establish the configuration / etc/fstab file

4. Quota management

Make constraints on the utilization of hard disk resources for users

1. Step: (format the hard disk to be operated)

Create a mount directory mkdir / public

Create a primary partition / dev/vdb5

Mount-o usrquota / dev/vdb5 / public # Mount partition

Chmod 777 / public # setting permissions for files should be set after the device is mounted, otherwise it will return to the default after it is mounted.

Edquota-u student sets the amount that student users can use

two。 Permanent configuration is configured in / etc/fstab

5. Disk encryption

LUKS (Linux Unified Key Setup) provides a calibration for Linux hard disk encryption, which is easy to operate, and only needs to enter a password when mounting the disk, not when writing and reading the disk.

1. Advantages and disadvantages

Advantages: increase the security of the system.

Disadvantages: it will reduce the read and write speed of the disk and increase the load of cpu.

Increase the security of the system at the expense of system performance. Therefore, the core disk should be encrypted.

two。 Steps:

1.df checks to see if the device is mounted. If so, uninstall it first.

2.cryptsetup luksFormat / dev/vdbx # encrypts a disk device and covers it with a lid

3.cryptsetup open / dev/vdbx westos # open the lid and give the lid a random name

4.ll / dev/mapper/westos View Virtual Appliance

5.mkfs.xfs / dev/mapper/hello # formatting virtual devices

6.mount / dev/mapper/hello / mnt/ mounting device

Touch / mnt/file {1.. 10} # add the file umount / mnt/ # uninstall the device cryptsetup close hello after use close the lid

3. Automatic mount of encrypted disk on boot

1. Edit / etc/fstab add mount policy

two。 Edit the decrypted file / etc/crypttab

3. Edit / root/key file

When 4.cryptsetup luksAddKey / dev/vdbx / root/westoskey # is powered on, the above files are automatically read and mounted automatically.

Note: the above files should be configured carefully. Errors will lead to failure.

6. Disk array

Fdisk / dev/vdb

-C: create a disk array-a: quto, if raid does not exist, it will be created automatically

-l: level, raid level (raid0, raid1)

-n: number of devices currently active

-x: the number of devices currently idle

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

Mkfs.xfs / dev/md0

Mount / dev/md0 / mnt/

Watch-n 1 cat / proc/mdstat

-f: faulty to cause errors on the disk and destroy the disk

Mdadm-f / dev/md0 / dev/vdb1

-D: check the status of raid

Mdadm-D / dev/md0

-r: remove, remove the disk

Mdadm-r / dev/md0 / dev/vdb1

-a:add add disk

Mdadm-a / dev/md0 / dev/vdb1

Umount / mnt/

S: stop, stop using raid, and then delete the partition in raid.

Mdadm-S / dev/md0

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report