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

Linux system disk format and manual addition of swap partitions

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Windows: supports NTFS, fat

Linux supports file formats:

Cat / etc/filesystems to see the file formats supported by Centos 7.

Xfs Centos 7 default file system name is xfs

Mount View / dev/vda1 on / type ext4 (rw,relatime,data=ordered)

Disk formatting

Mke2fs-t exet4 specifies the format of the file system to format

Mke2fs-b specifies the block size

For example: mke2fs-t ext4-b 2048 / dev/sdb1 # specifies that the file system format is ext4, block size is 2048k, format / dev/sdb1 disk (the principle is the same as windows format)

Blkid to view unmounted partitions

Mkfs.ext4 = mke2fs-t ext4

Mke2fs-b 8192 / dev/sdb1

Note: the distinction between 8192 and 4096:

When the stored file is a large file such as video, 8192 is recommended, which can speed up the reading and writing speed.

4096 or 2048 is recommended when the stored files are small files, etc.

When formatting the hard drive, 5% of the space is reserved for root users, which takes up a lot of space and sets the reserved space:

Mke2fs-M1 / dev/sdb1 sets the reserved space to 1%

Mke2fs-m 0.1 / dev/sdb1 sets the reserved space to 0.1%

Mkfs.ext4-m 0.1 / dev/sdb1

Do not specify the file system format is, default is ext2

Mke2fs-I 8192 ext4 / dev/sdb1 set to 8192 bytes to an inode

Set the file format to xfs

Mkfs.xfs / dev/sdb1

Swap space: up to 8G

1. Analog disk

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

Note:

Zeroing

It's not a space, it's a file.

/ dev/zero is a special device with an endless stream of "zeros"

If specifies the source device

Of specifies the target device

View swap disk size

View swap disk size

Du-sh / name

two。 Formatting

Swap formatting

Mkswap / path

Add the newly built swap space to the original swap space.

Check the current swap space first.

Free-m

Hang it on the original swap space.

Hint, unsafe permission 0644, it is recommended to use 0600, although prompted, but will still be mounted to the original swap space.

To ensure security, you can modify permissions

Chmod 0600 / newdisk

Uninstall the swap space and delete it directly, then you can restore the original space.

1 swapoff / newdisk

2 rm-f / newdisk

Blkid View File format

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