linux把大硬盘挂载到某个目录下

首先,直接挂硬盘是不行的;需要给硬盘做一个文件系统(filesystem)和分区

1,fdisk /dev/nvme0  

给划出自己需要的分区nvme0n1

2,给分区做系统

mkfs.ext4 /dev/nvme0n1

3,挂载

mount /dev/nvme0n1 /mnt

4,开机自动挂载

vim /etc/fstab

/dev/nvme0n1 /mnt ext4 defaults 1 1

另一种大于2T硬盘

 

root@node01:/mnt# parted /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

 

(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk
will be lost. Do you want to continue?
Yes/No? yes         

   

(parted) print                                                            
Model: DELL PERC 6/i Adapter (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

 

(parted)mkpart primary 0KB 500GB
Warning: You requested a partition from 0.00B to 500GB.                   
The closest location we can manage is 17.4kB to 500GB.
Is this still acceptable to you?
Yes/No? yes                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                          

 

(parted) print                                                            
Model: DELL PERC 6/i Adapter (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size   File system  Name     Flags
 1      17.4kB  500GB  500GB               primary

 

(parted)quit                                                             

Information: You may need to update /etc/fstab.   

因为ext4不支持大于16T的硬盘,所以使用xfs

mkfs.xfs /dev/sdb1   

 

2018.9.29碰到mount /dev/sdb  /u02

can't read superblock

解决方法

mkfs.xfs -f /dev/sdb

mount /dev/sdb /u02

成功

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值