Linux Device Mount

查看device情况
# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0 931.5G  0 part 
└─sda2   8:2    0   728K  0 part 
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0 931.5G  0 part 
└─sdb2   8:18   0   728K  0 part 
sdc      8:32   0 931.5G  0 disk 
├─sdc1   8:33   0 931.5G  0 part 
└─sdc2   8:34   0   728K  0 part 
sdd      8:48   0 372.6G  0 disk 
├─sdd1   8:49   0     2G  0 part /boot
└─sdd2   8:50   0 370.6G  0 part /
sde      8:64   0 931.5G  0 disk 
├─sde1   8:65   0 931.5G  0 part 
└─sde2   8:66   0   728K  0 part 
sdf      8:80   0 931.5G  0 disk 
├─sdf1   8:81   0 931.5G  0 part 
└─sdf2   8:82   0   728K  0 part 
sdg      8:96   0 931.5G  0 disk 
├─sdg1   8:97   0 931.5G  0 part 
└─sdg2   8:98   0   728K  0 part 
sdh      8:112  0 931.5G  0 disk 
├─sdh1   8:113  0 931.5G  0 part 
└─sdh2   8:114  0   728K  0 part 
sr0     11:0    1  1024M  0 rom 

其中以下是系统盘
sdd 8:48 0 372.6G 0 disk
├─sdd1 8:49 0 2G 0 part /boot
└─sdd2 8:50 0 370.6G 0 part /

-f, --fs output info about filesystems

$ lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
vda                                                      
└─vda1 ext4         d88fc7aa-ac7f-42c2-bd5c-b71230af3c62 /
vdb    xfs          9bfc239c-8255-4a0e-bfe3-f8b2b162bbf4 /data
删除分区操作

比如删除 /dev/sdh里两个子分区

# fdisk /dev/sdh

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sdh: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000aff8d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1            2048  1953523711   976760832   83  Linux
/dev/sdh2      1953523712  1953525167         728   83  Linux

Command (m for help): d
Partition number (1,2, default 2): 1
Partition 1 is deleted

Command (m for help): d
Selected partition 2
Partition 2 is deleted

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

重建分区操作
# fdisk /dev/sdh 

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sdh: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000aff8d

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n      
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-1953525167, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1953525167, default 1953525167): 
Using default value 1953525167
Partition 1 of type Linux and of size 931.5 GiB is set

Command (m for help): p

Disk /dev/sdh: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000aff8d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1            2048  1953525167   976761560   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

新建分区后进行格式化
# mkfs.ext4 /dev/sdh1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61054976 inodes, 244190390 blocks
12209519 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2392850432
7453 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done     

mount 前,查看device UUID
# blkid
/dev/sdd2: UUID="e9338af3-fce1-4907-942c-3423610ac759" TYPE="xfs" 
/dev/sda1: UUID="155744f6-be67-4785-bc23-f98c5494b813" TYPE="ext4" 
/dev/sdb1: UUID="00f9b47a-c512-4329-a656-b99f909ab79d" TYPE="ext4" 
/dev/sdc1: UUID="35b7628d-425e-4f54-91c6-1eba23f4b061" TYPE="ext4" 
/dev/sde1: UUID="3354c6d4-8e01-486f-a5aa-4b3cdb139938" TYPE="ext4" 
/dev/sdd1: UUID="9b49eabe-0963-4cec-8305-7c0df63f77dd" TYPE="xfs" 
/dev/sdf1: UUID="519adea4-e630-4c7a-8d9e-3a367dde5ec5" TYPE="ext4" 
/dev/sdg1: UUID="242c4793-7051-4968-ac31-3a814e46a1c7" TYPE="ext4" 
/dev/sdh1: UUID="d4450a1b-e8b7-421e-8787-6870709c0120" TYPE="ext4" 

创建需要挂载的目录
mkdir DP_disk{1..7}
编写挂载配置文件

将以下添加到 /etc/fstab里

UUID=155744f6-be67-4785-bc23-f98c5494b813 /mnt/DP_disk1 ext4 noatime,nodiratime  0  0
UUID=00f9b47a-c512-4329-a656-b99f909ab79d /mnt/DP_disk2 ext4 noatime,nodiratime  0  0
UUID=35b7628d-425e-4f54-91c6-1eba23f4b061 /mnt/DP_disk3 ext4 noatime,nodiratime  0  0
UUID=3354c6d4-8e01-486f-a5aa-4b3cdb139938 /mnt/DP_disk4 ext4 noatime,nodiratime  0  0
UUID=519adea4-e630-4c7a-8d9e-3a367dde5ec5 /mnt/DP_disk5 ext4 noatime,nodiratime  0  0
UUID=242c4793-7051-4968-ac31-3a814e46a1c7 /mnt/DP_disk6 ext4 noatime,nodiratime  0  0
UUID=d4450a1b-e8b7-421e-8787-6870709c0120 /mnt/DP_disk7 ext4 noatime,nodiratime  0  0
# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Oct 21 08:15:14 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=e9338af3-fce1-4907-942c-3423610ac759 /                       xfs     defaults        0 0
UUID=9b49eabe-0963-4cec-8305-7c0df63f77dd /boot                   xfs     defaults        0 0

UUID=155744f6-be67-4785-bc23-f98c5494b813 /mnt/DP_disk1 ext4 noatime,nodiratime  0  0
UUID=00f9b47a-c512-4329-a656-b99f909ab79d /mnt/DP_disk2 ext4 noatime,nodiratime  0  0
UUID=35b7628d-425e-4f54-91c6-1eba23f4b061 /mnt/DP_disk3 ext4 noatime,nodiratime  0  0
UUID=3354c6d4-8e01-486f-a5aa-4b3cdb139938 /mnt/DP_disk4 ext4 noatime,nodiratime  0  0
UUID=519adea4-e630-4c7a-8d9e-3a367dde5ec5 /mnt/DP_disk5 ext4 noatime,nodiratime  0  0
UUID=242c4793-7051-4968-ac31-3a814e46a1c7 /mnt/DP_disk6 ext4 noatime,nodiratime  0  0
UUID=d4450a1b-e8b7-421e-8787-6870709c0120 /mnt/DP_disk7 ext4 noatime,nodiratime  0  0
使mount 配置文件生效
mount -a

查看

# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sdd2      xfs       371G  1.4G  370G   1% /
devtmpfs       devtmpfs  126G     0  126G   0% /dev
tmpfs          tmpfs     126G     0  126G   0% /dev/shm
tmpfs          tmpfs     126G   11M  126G   1% /run
tmpfs          tmpfs     126G     0  126G   0% /sys/fs/cgroup
/dev/sdd1      xfs       2.0G  143M  1.9G   8% /boot
tmpfs          tmpfs      26G     0   26G   0% /run/user/0
/dev/sda1      ext4      917G  378G  493G  44% /mnt/DP_disk1
/dev/sdb1      ext4      917G  373G  498G  43% /mnt/DP_disk2
/dev/sdc1      ext4      917G  378G  493G  44% /mnt/DP_disk3
/dev/sde1      ext4      917G  377G  494G  44% /mnt/DP_disk4
/dev/sdf1      ext4      917G  377G  494G  44% /mnt/DP_disk5
/dev/sdg1      ext4      917G  384G  487G  45% /mnt/DP_disk6
/dev/sdh1      ext4      917G   77M  871G   1% /mnt/DP_disk7

mklost+found
# mklost+found
mklost+found 1.45.6 (20-Mar-2020)
[root@vsr533 DP_disk1]# ll
total 48
drwx------ 2 root root 49152 May  6 13:23 lost+found

查看磁盘情况
yum install smartmontools
# smartctl -i /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-128-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Intel S4510/S4610/S4500/S4600 Series SSDs
Device Model:     INTEL SSDSC2KB480G8
Serial Number:    BTYF921400VG480BGN
LU WWN Device Id: 5 5cd2e4 150a8696f
Firmware Version: XCV10110
User Capacity:    480,103,981,056 bytes [480 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Thu Oct 20 13:24:06 2022 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值