服务器硬盘挂载(服务器硬盘挂载到台式机)
- 服务器
- 2022-12-20 04:08:28
- 16
今天给各位分享服务器硬盘挂载的知识,其中也会对服务器硬盘挂载到台式机进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、Linux之NTFS、FAT32、exFAT 各种格式硬盘挂载整理
- 2、Linux磁盘挂载和扩容(1)
- 3、linux服务器挂载ntfs格式硬盘
- 4、linux下如何挂载硬盘?
- 5、SUSE Linux硬盘格式化及挂载
- 6、CentOS | 硬盘挂载与解挂
Linux之NTFS、FAT32、exFAT 各种格式硬盘挂载整理
由于业务需要频繁处理大量视频(几十GB),通过公司内网传输太慢,于是就每次处理视频时需要在服务器挂载硬盘或U盘。业务人员给的硬盘或U盘格式有时不一样,目前遇到的格式:NTFS、FAT32、exFAT,这几种格式大家在Windows上基本很常见,于是总结了这些格式的硬盘如何有效挂载到Linux服务器,分享出来供大家参考
第一步:安装驱动 ntfs-3g
第二步:查看硬盘信息(硬盘已通过USB插入服务器)
会在最后列出该硬盘的信息,一般是sdb,默认只有1个分区,下面挂载时用的是 sdb1
但有的硬盘里面也有2个分区的,如下所示:
如果是这种情况,下面挂载时就需要用到 sdb2
第三步:挂载硬盘
第四步:解除挂载
硬盘挂载基本就以上这四步,下面主要列出其他格式硬盘挂载的重点步骤
不需要驱动,可以直接挂载
下面的挂载命令 支持 中文、挂载后不同用户可读写权限 ,具体参数含义可自行百度查询
第三步:挂载硬盘
第一步:安装驱动 fuse-exfat 、 exfat-utils
第三步:挂载硬盘
以上是自己实践中遇到的一些问题,分享出来供大家参考学习,欢迎关注DataShare,不定期分享干货
Linux磁盘挂载和扩容(1)
本章我们先介绍Linux服务器磁盘挂载,下期介绍Linux磁盘扩容问题。
Linux磁盘挂载有两种情况
1. 小于2T磁盘挂载
2. 大于2T磁盘挂载
下面我们分别介绍两种情况的挂载方式
以下磁盘名称都以/dev/sdc为例
挂载小于2T的磁盘也分两种
第一种,直接挂载裸盘,此刻就不用创建分区
在这种情况下,可以直接格式化磁盘,我们这里用ext4格式,当然也可以使用xfs格式
1)格式化分区
2)挂载磁盘
在挂载磁盘之前为了防止机器重启的时候没有加载磁盘,我们需要添加配置文件
1)创建分区
在这种情况下,我们需要先将裸盘创建分区,需要使用fdisk命令
以下都是按照实际运维工作中使用的介绍,还有特殊情况可以自行搜索文档研究。
3) 挂载分区
和上面一样,挂载大于2T的磁盘也分裸盘和分区
第一种,挂载裸盘的话,和小于2T一样,不涉及分区情况,可以直接挂载,具体挂载方式可以参考小于2T的裸盘挂载方式
下面具体说一下第二种,磁盘分区挂载
这种方式已经不能使用fdisk工具了,fdisk只适合划分2T一下的磁盘,此刻需要用到的工具是parted
1)建立磁盘标签GPT
parted /dev/sdc
查看当前磁盘信息
print 可以看到磁盘还没有分区
我们这里使用创建主分区,并且使用全部磁盘
mkpart primary 0% 100%
4) 挂载磁盘
这里也参考上面的磁盘挂载,写入配置文件/etc/fstab,这里为了简便,我直接在命令行挂载了。
此时可以看到磁盘已经挂载
linux服务器挂载ntfs格式硬盘
首先查看U盘或者移动硬盘文件系统格式
U盘:
移动硬盘:
windows下支持的文件系统格式主要是FAT,ntfs。
inux常见的文件系统有:JFS、 ReiserFS、ext、ext2、ext3、ISO9660、XFS、Minx、MSDOS、UMSDOS、VFAT、NTFS、HPFS、NFS、 SMB、SysV、PROC
不同的文件系统格式的存储设备在linux上挂载的方式不同。
像我的一个硬盘两块分区,各自格式不同就比较麻烦
下面开始正式操作
上面的框是已挂载的,下面的是USB接入的硬盘
成功之后查看:
就可以当普通硬盘一样使用了
直接 cd /ntft 即可进入硬盘目录
查看文件传输速度:
linux下如何挂载硬盘?
1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘
#fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
2.格式化硬盘
#mkfs -t ext4 /dev/sdb
3.挂载硬盘
#mount 硬盘地址 要挂载的地址
#mount /dev/sdb /media/imgs
4.实现系统重启后自动挂载该分区
#vi /etc/fstab
在最后一行添加
/dev/sdb /media/imgs ext4 defaults 1 2
一、添加磁盘
添加加新硬盘重启服务器
添加完之后就可以重启机器了,如果你机器是开启的,进入系统并不能看见你刚添加的那块磁盘,只有等系统重启,重新加载之后才会显示安装的那块磁盘
二、进入系统
使用root用户进入系统
三、 查看硬盘信息
[root@localhost ~]# fdisk -l //磁盘命令
1
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c4cb5
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd0f5c869
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
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
28
可以看到这台机器加载了三个磁盘sda、sdb、sdc
其中sda是初始磁盘,sdb已经初始化且经过使用,sdc是刚刚加载的,未格式化的新磁盘
四、创建新硬盘分区
[root@localhost ~]# fdisk /dev/sdc #进入磁盘
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x45a3cadb.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag #设定可启动标记
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition #删除一个分区
l list known partition types #各分区类型所对应的ID
m print this menu #菜单
n add a new partition #添加一个分区
o create a new empty DOS partition table
p print the partition table #显示该磁盘下的当前分区信息
q quit without saving changes #不保存退出
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit #保存退出
x extra functionality (experts only)
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
28
29
30
31
知道命令之后就可以进行分区了
Command (m for help): p //打印分区信息,可以看到当前并没有分区
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb
Device Boot Start End Blocks Id System
Command (m for help): n //创建一个新的分区
Command action
e extended//输入e为创建扩展分区
p primary partition (1-4) //输入p为创建逻辑分区
p
Partition number (1-4): 1//划分逻辑分区
First cylinder (1-2610, default 1): //我这里直接回车,是不想把该磁盘分成多个分区,把整个磁盘作为1个分区
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):
Using default value 2610
Command (m for help): p //再次查看可以看到该磁盘已经有1个分区了
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ 83 Linux
Command (m for help): w //保存分区
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
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
28
29
30
31
32
33
34
35
36
37
38
39
再次使用”fdisk -l”命令查看磁盘信息
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x406a4c58
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ 83 Linux
1
2
3
4
5
6
7
8
9
第三块磁盘/dev/sdc已经分区好了
五、格式化分区
[root@localhost ~]# mkfs.ext3 /dev/sdc1
//将/dev/sdc1格式化为ext3类型,好像大部分的磁盘都是格式化为ext3类型,具体为什么没有深入研究,暂时不清楚,想了解的朋友可以自己查一下
1
2
[root@localhost ~]# mkfs.ext3 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
160 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
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
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
格式化完毕,此时就可以使用“mount”命令挂载分区了,然后使用这个磁盘空间了
六、挂载分区以及开机自动挂载
[root@localhost ~]# df -h //此时只有sda1和sdb1两个磁盘挂载
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 18G 15G 1.5G 92% /
tmpfs 932M 76K 932M 1% /dev/shm
/dev/sda1 485M 40M 421M 9% /boot
/dev/sdb1 20G 1.2G 18G 7% /disk/diskone
/dev/sr0 4.2G 4.2G 0 100% /media/CentOS_6.5_Final
[root@localhost /]# cd /disk/
[root@localhost disk]# ll
总用量 4
drwxr-xr-x. 4 root root 4096 7月 28 17:04 diskone
[root@localhost disk]# cd diskone/
[root@localhost diskone]# ll
总用量 20
drwx------. 2 root root 16384 7月 28 16:12 lost+found
drwxr-xr-x. 2 root root 4096 7月 28 17:09 software
[root@localhost diskone]# cd ../
[root@localhost disk]# mkdir disktwo //创建被挂载的路径
[root@localhost disk]# ll
总用量 8
drwxr-xr-x. 4 root root 4096 7月 28 17:04 diskone
drwxr-xr-x. 2 r
SUSE Linux硬盘格式化及挂载
操作系统版本:SUSE Linux Enterprise Server 12 SP4
1.查看服务器的所有硬盘
2.检查是否已经格式化
3.格式化硬盘
4.新建目录
5.挂载目录
6.查看硬盘的UUID
7.将硬盘对应的UUID配置到fstab文件
8.自动挂载验证
9.目录验证
CentOS | 硬盘挂载与解挂
常常服务器会因为重启等原因导致硬盘解挂载,因此学习一门硬盘挂载技术还是非常重要的。
一般来说,硬盘可以用以下命令行进行挂载:
其中我们需要知道以下信息:
那么如何获取上述信息呢?可应用以下命令完成[2]。
硬盘的解挂载需要首先杀掉占用硬盘的任务,然后在进行解挂载。
[1] (33条消息) Linux文件系统类型介绍_胡胡大妞的博客-CSDN博客_linux文件系统类型
[2] linux下查看磁盘分区的文件系统格式 - Goose77593 - 博客园 (cnblogs.com)
关于服务器硬盘挂载和服务器硬盘挂载到台式机的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
本文由admin于2022-12-20发表在靑年PHP官网,如有疑问,请联系我们。
本文链接:https://qnphp.com/post/170447.html