linux磁盘挂载

查看磁盘信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fdisk -l

oot@tiantian-MS-7A36:/# fdisk -l
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8381099c

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 217761791 217759744 103.9G 83 Linux
/dev/sda2 217763838 234440703 16676866 8G 5 Extended
/dev/sda5 217763840 234440703 16676864 8G 82 Linux swap / Solaris


Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe1eaf634

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 784384 717518847 716734464 341.8G 7 HPFS/NTFS/exFAT
/dev/sdb2 717518848 1953454079 1235935232 589.3G 7 HPFS/NTFS/exFAT
root@tiantian-MS-7A36:/#

将sb1挂载到/data目录下

1
mount /dev/sdb1 /data

取消sdb1磁盘挂载

1
umount /dev/sdb1

在取消挂载的时候,如果当前有人在使用这个磁盘,那么就会报错

1
2
3
umount: /data: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)