First, disk format
Disk partition can not be used directly, you need to format each partition, formatting is actually installed system files.
Command mke2fs: Formatting into XFS system files is not supported
MKFS.EXT4 = = mke2fs-t ext4 two commands equal
-B: Sets the amount of space that each data chunk occupies when partitioning
-I: Indicates the size of the inode is set
-N: Indicates data for inode setting
-C: Indicates if there is a problem detecting the disk before formatting
-L: The label that represents the default partition
-T: Used to specify the type of file system
[Email protected] ~]# fdisk-l
Disk/dev/sda:42.9 GB, 42949672960 bytes, 83,886,080 sectors
Units = Sector of 1 * bytes
Sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
Disk label Type: dos
Disk identifier: 0x000a020f
Device Boot Start End Blocks Id System
/DEV/SDA1 * 2048 821247 409600 Linux
/dev/sda2 821248 9209855 4194304, Linux Swap/solaris
/dev/sda3 9209856 83886079 37338112-up Linux
Disk/dev/sdb:21.5 GB, 21474836480 bytes, 41,943,040 sectors
Units = Sector of 1 * bytes
Sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
Disk label Type: dos
Disk identifier: 0XB2AEE2FE
Device Boot Start End Blocks Id System
/DEV/SDB1 4096 4100095 2048000-up Linux
Format Ext System File
[Email protected] ~]# mke2fs-t ext4/dev/sdb1
MKE2FS 1.42.9 (28-dec-2013)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
128000 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=524288000
Block groups
32768 blocks per group, 32768 fragments per group
8000 Inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
MKFS command
[Email protected] ~]# mkfs.ext4/dev/sdb1
MKE2FS 1.42.9 (28-dec-2013)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
128000 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=524288000
Block groups
32768 blocks per group, 32768 fragments per group
8000 Inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
Force formatting into XFS system files
[Email protected] ~]# mkfs.xfs-f/dev/sdb1
META-DATA=/DEV/SDB1 isize=512 agcount=4, agsize=128000 blks
= sectsz=512 attr=2, projid32bit=1
= Crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=512000, imaxpct=25
= Sunit=0 swidth=0 blks
Naming =version 2 bsize=4096 ascii-ci=0 ftype=1
Log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 Blks, lazy-count=1
Realtime =none extsz=4096 blocks=0, rtextents=0
[Email protected] ~]#
Extension: Format a large file block 8192B
[Email protected] ~]# mke2fs-b 8192/dev/sdb1
Warning:blocksize 8192 not usable in most systems.
MKE2FS 1.42.9 (28-dec-2013)
Mke2fs:8192-byte blocks too big for system (max 4096)
Do you want to continue anyway? (Y,n)
No file system specified using Blkid
[Email protected] ~]# blkid/dev/sdb1
/dev/sdb1:uuid= "7b86ac38-ba70-4428-825b-7d4397fd0d18" type= "XFS"
[Email protected] ~]#
Specifies the format of the EXT4 system file
[Email protected] ~]# mke2fs-t ext4-m 0.1/dev/sdb1
MKE2FS 1.42.9 (28-dec-2013)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
128000 inodes, 512000 blocks
Blocks (0.10%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=524288000
Block groups
32768 blocks per group, 32768 fragments per group
8000 Inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
[Email protected] ~]#
[Email protected] ~]# mkfs.ext4-m 0.1/dev/sdb1
MKE2FS 1.42.9 (28-dec-2013)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
128000 inodes, 512000 blocks 1:4 relationship
Blocks (0.10%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=524288000
Block groups
32768 blocks per group, 32768 fragments per group
8000 Inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
[Email protected] ~]#
-I two sub-block corresponds to a inodes
[Email protected] ~]# mke2fs-i 8192-t ext4/dev/sdb1
MKE2FS 1.42.9 (28-dec-2013)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
256000 inodes, 512000 blocks 1:2 relationship
25600 blocks (5.00%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=524288000
Block groups
32768 blocks per group, 32768 fragments per group
16000 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (8192 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
[Email protected] ~]#
Second, disk mount
Mount command
The formatted disk is actually a block device file, type B.
A mount point needs to be established prior to mounting the partition, and the mount point exists as a directory. Once a partition is attached to this mount point (directory), it will be written to this directory when it is going to the data.
Note: Before mounting the partition, this mount point (directory) must be empty, and once mounted successfully, the files in that directory cannot be seen (data is not lost) and only the partitions can be unloaded.
Delete/DEV/SDB partition
[Email protected] ~]# Fdisk/dev/sdb
You are welcome to use FDISK (Util-linux 2.23.2).
The changes will remain in memory until you decide to write the changes to disk.
Think twice before you use the Write command.
Command (enter M for help): P
Disk/dev/sdb:21.5 GB, 21474836480 bytes, 41,943,040 sectors
Units = Sector of 1 * bytes
Sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
Disk label Type: dos
Disk identifier: 0XB2AEE2FE
Device Boot Start End Blocks Id System
/DEV/SDB1 4096 4100095 2048000-up Linux
Command (enter M for help): D
Partition 1 selected
Partition 1 has been deleted
Command (enter M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
The disk is being synchronized.
[Email protected] ~]#
[Email protected] ~]# fdisk-l
Disk/dev/sda:42.9 GB, 42949672960 bytes, 83,886,080 sectors
Units = Sector of 1 * bytes
Sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
Disk label Type: dos
Disk identifier: 0x000a020f
Device Boot Start End Blocks Id System
/DEV/SDA1 * 2048 821247 409600 Linux
/dev/sda2 821248 9209855 4194304, Linux Swap/solaris
/dev/sda3 9209856 83886079 37338112-up Linux
Disk/dev/sdb:21.5 GB, 21474836480 bytes, 41,943,040 sectors
Units = Sector of 1 * bytes
Sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
Disk label Type: dos
Disk identifier: 0XB2AEE2FE
Device Boot Start End Blocks Id System
[Email protected] ~]#
Format into XFS system files
[Email protected] ~]# mkfs.xfs-f/dev/sdb
Meta-data=/dev/sdb isize=512 agcount=4, agsize=1310720 blks
= sectsz=512 attr=2, projid32bit=1
= Crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242880, imaxpct=25
= Sunit=0 swidth=0 blks
Naming =version 2 bsize=4096 ascii-ci=0 ftype=1
Log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 Blks, lazy-count=1
Realtime =none extsz=4096 blocks=0, rtextents=0
[Email protected] ~]#
[Email protected] ~]# blkid/dev/sdb
/dev/sdb:uuid= "d989574f-6066-4e70-b16a-87a2fff5fd57" type= "XFS"
[Email protected] ~]#
[[email protected] ~]# blkid view mounted files
/dev/sdb:uuid= "d989574f-6066-4e70-b16a-87a2fff5fd57" type= "XFS"
/dev/sda1:uuid= "9fe873cc-5873-441a-b6ec-5cb477d2bf17" type= "XFS"
/dev/sda2:uuid= "448ba3ec-a7ba-44c1-90cb-1c76f09347ef" type= "swap"
/dev/sda3:uuid= "3227dd23-e9cd-44ff-b332-cb045a7c929a" type= "XFS"
/dev/sr0:uuid= "2017-09-06-10-53-42-00" label= "CentOS 7 x86_64" type= "iso9660" pttype= "DOS"
Mount to mount Directory
[[email protected] ~]# df-h
File system capacity used% mount point available
/dev/sda3 36G 1009M 35G 3%/
Devtmpfs 907M 0 907M 0%/dev
tmpfs 916M 0 916M 0%/dev/shm
Tmpfs 916M 8.7M 908M 1%/run
Tmpfs 916M 0 916M 0%/sys/fs/cgroup
/dev/sda1 397M 123M 274M 31%/boot
tmpfs 184M 0 184M 0%/run/user/0[[email protected] ~]#
Mount under the MNT directory
[Email protected] ~]# mount/dev/sdb/mnt/
[Email protected] ~]# df-h
File system capacity has been used with available% mount points
/dev/sda3 36G 1009M 35G 3%/
Devtmpfs 907M 0 907M 0%/dev
Tmpfs 916M 0 916M 0%/dev/shm
Tmpfs 916M 8.7M 908M 1%/run
Tmpfs 916M 0 916M 0%/sys/fs/cgroup
/DEV/SDA1 397M 123M 274M 31%/boot
Tmpfs 184M 0 184M 0%/run/user/0
/dev/sdb 20G 33M 20G 1%/mnt
[Email protected] ~]#
[email protected] ~]# mount
Sysfs On/sys type SYSFS (Rw,nosuid,nodev,noexec,relatime,seclabel)
Proc On/proc type proc (rw,nosuid,nodev,noexec,relatime)
Devtmpfs On/dev type DEVTMPFS (rw,nosuid,seclabel,size=927848k,nr_inodes=231962,mode=755)
SECURITYFS on/sys/kernel/security type SECURITYFS (rw,nosuid,nodev,noexec,relatime)
Tmpfs on/dev/shm type TMPFS (Rw,nosuid,nodev,seclabel)
Devpts on/dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
Tmpfs on/run type TMPFS (rw,nosuid,nodev,seclabel,mode=755)
Tmpfs on/sys/fs/cgroup type TMPFS (ro,nosuid,nodev,noexec,seclabel,mode=755)
Cgroup on/sys/fs/cgroup/systemd type Cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/ SYSTEMD-CGROUPS-AGENT,NAME=SYSTEMD)
Pstore on/sys/fs/pstore type Pstore (rw,nosuid,nodev,noexec,relatime)
Cgroup On/sys/fs/cgroup/net_cls,net_prio type Cgroup (RW,NOSUID,NODEV,NOEXEC,RELATIME,NET_PRIO,NET_CLS)
Cgroup on/sys/fs/cgroup/memory type Cgroup (rw,nosuid,nodev,noexec,relatime,memory)
Cgroup on/sys/fs/cgroup/perf_event type Cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
Cgroup On/sys/fs/cgroup/blkio type Cgroup (Rw,nosuid,nodev,noexec,relatime,blkio)
Cgroup on/sys/fs/cgroup/hugetlb type Cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
Cgroup on/sys/fs/cgroup/cpuset type Cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
Cgroup on/sys/fs/cgroup/devices type Cgroup (rw,nosuid,nodev,noexec,relatime,devices)
Cgroup On/sys/fs/cgroup/cpu,cpuacct type Cgroup (RW,NOSUID,NODEV,NOEXEC,RELATIME,CPUACCT,CPU)
Cgroup on/sys/fs/cgroup/freezer type Cgroup (Rw,nosuid,nodev,noexec,relatime,freezer)
Cgroup on/sys/fs/cgroup/pids type Cgroup (rw,nosuid,nodev,noexec,relatime,pids)
Configfs on/sys/kernel/config type Configfs (rw,relatime)
/dev/sda3 on/type XFS (Rw,relatime,seclabel,attr2,inode64,noquota)
SELINUXFS on/sys/fs/selinux type SELINUXFS (rw,relatime)
Systemd-1 on/proc/sys/fs/binfmt_misc type AutoFS (Rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct, pipe_ino=11972)
Debugfs on/sys/kernel/debug type Debugfs (rw,relatime)
Mqueue on/dev/mqueue type Mqueue (Rw,relatime,seclabel)
Hugetlbfs on/dev/hugepages type HUGETLBFS (Rw,relatime,seclabel)
/DEV/SDA1 on/boot type XFS (Rw,relatime,seclabel,attr2,inode64,noquota)
Tmpfs on/run/user/0 type TMPFS (rw,nosuid,nodev,relatime,seclabel,size=187548k,mode=700)
/dev/sdb on/mnt type XFS (Rw,relatime,seclabel,attr2,inode64,noquota)
[Email protected] ~]#
Unloading
[Email protected] ~]# cd/mnt/
[[email protected] mnt]# ls
[[email protected] mnt]# Touch 0.txt 3.txt
[Email protected] mnt]# mkdir 465
[Email protected] mnt]#
[Email protected] mnt]# Umount/dev/sdb
Umount:/mnt: Target busy.because it cannot be uninstalled under the MNT directory
(In some cases, by lsof (8) or fuser (1), you can
Find useful information about processes that use this device)
[Email protected] mnt]#
[Email protected] mnt]# pwdView current directory
/mnt
[[Email protected] mnt]# CDExit Mnt
[Email protected] ~]#Umount/dev/sdb Uninstall
[Email protected] ~]# df-h
File system capacity has been used with available% mount points
/dev/sda3 36G 1009M 35G 3%/
Devtmpfs 907M 0 907M 0%/dev
Tmpfs 916M 0 916M 0%/dev/shm
Tmpfs 916M 8.7M 908M 1%/run
Tmpfs 916M 0 916M 0%/sys/fs/cgroup
/DEV/SDA1 397M 123M 274M 31%/boot
Tmpfs 184M 0 184M 0%/run/user/0
[Email protected] ~]#
Uninstall directly under the MNT directory
[Email protected] ~]# cd/mnt/
[Email protected] mnt]# umount-l/mnt/
Extended
[Email protected] ~]# Vi/etc/fstab
#/etc/fstab
# Created by Anaconda on Fri Mar 23 06:04:08 2018
#
# Accessible filesystems, by reference, is maintained under '/dev/disk '
# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info
#
UUID=3227DD23-E9CD-44FF-B332-CB045A7C929A/XFS Defaults 0 0
Uuid=9fe873cc-5873-441a-b6ec-5cb477d2bf17/boot XFS Defaults 0 0
UUID=448BA3EC-A7BA-44C1-90CB-1C76F09347EF swap swap defaults 0 0
/dev/sdb/mnt XFS Defaults 0 0
Third, manually increase the swap space
[[email protected] ~]# dd If=/dev/zero of=/tmp/newdisk bs=1m count=100 add 1 100M files
Recorded 100+0 read-in
Recorded the writing of 100+0.
104857600 bytes (MB) copied, 0.905401 sec, mb/sec
[Email protected] ~]#
[Email protected] ~]# Du-sh/tmp/newdisk
100m/tmp/newdisk
[Email protected] ~]# mkswap-f/tmp/newdisk
Setting swap space version 1, size = 102396 KiB
No label, uuid=54c8d90a-9ecf-4c8b-9615-7e635194e0f0
[Email protected] ~]#
[Email protected] ~]# free-m
Total used free shared buff/cache available
MEM:1831 127 1427 8 275 1527
swap:4095 0 4095
[Email protected] ~]#
[Email protected] ~]# Swapon/tmp/newdisk
Swapon:/tmp/newdisk: Unsafe Permissions 0644, 0600 is recommended.
[Email protected] ~]#
[Email protected] ~]# free-m
Total used free shared buff/cache available
MEM:1831 127 1427 8 275 1527
swap:4195 0 4195
[[email protected] ~]# chmod 0600/tmp/newdisk After setting permissions security
[Email protected] ~]#
Unloading
[Email protected] ~]# Swapoff/tmp/newdisk
[Email protected] ~]# free-m
Total used free shared buff/cache available
MEM:1831 127 1427 8 275 1527
swap:4095 0 4095
[Email protected] ~]#
Linux centosvmware disk format, disk mount, manually increase swap space