Ubuntu 挂载16T硬盘笔记

Ubuntu 挂载16T硬盘笔记

一、分区

查看硬盘信息
# 查看硬盘
sudo fdisk -l
# 下面是显示的硬盘信息

# Disk /dev/sda: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
# Disk model: ST16000NM000J-2T
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 4096 bytes
# I/O size (minimum/optimal): 4096 bytes / 4096 bytes
设置硬盘信息
# 进入 parted
sudo parted /dev/sda
# 设置全部容量为 GPT格式
mkpart logical 0 -1

按照文章所说,默认进行分了一个/dev/sda1这个分区,但是我这里报了一个错误:

Error: /dev/sda: unrecognised disk label

经过查找,找到了原因,这是因为我并没有把硬盘标记为gpt,执行以下内容。
这里仅记录命令,注释记录一下,具体执行情况看最后面的完整记录。

sudo parted /dev/sda

# parted 内

# 设置为gpt格式
mklabel gpt
# 全部空间分到一个区
mkpart logical 0 -1

# 此处出现一个警告,我按文章的步骤直接输入了Ignore回车了。

# 查看分区结果
print 

# 输入 quit,退出 parted后ls检查一下,发现多了一个出来
quit

# 现在退出了 parted
ls /dev/sd*
# 结果显示多出来一个sda1: sda  sda1

二、格式化

这里注意,格式化执行过程中前面两三个一瞬间就好了,最后一个等待了好一阵子
Writing superblocks and filesystem accounting information

root@home:/dev# partprobe
root@home:/dev# ls sd*
sda  sda1
root@home:/dev# sudo mkfs.ext4 -F /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
/dev/sda1 alignment is offset by 3072 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Creating filesystem with 3906469639 4k blocks and 488308736 inodes
Filesystem UUID: 32a17ecf-702a-4a5c-8f26-9bef22efb821
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
        2560000000, 3855122432

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

三、挂载

使用 sudo vim /etc/fstab 修改文件,在文件末尾补上以下内容
第一个参数是自己命名的,需要提前创建路径好像

/dev/sda1 /perry_hd_16 ext4 defaults 0 0

然后执行命令重新挂载

sudo mount -a

输入 df -hT 检查一下,看到了自己挂上去的东西,应该是OK了。

/dev/sda1 ext4 15T   28K   14T   1% /perry_hd_16

据说现在就可以开机自动挂上去了,完结撒花。

四、分区与格式化完整执行记录

root@home:/dev# sudo fdisk -l

Disk /dev/sda: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: ST16000NM000J-2T
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes 

root@home:/dev# sudo parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) mkpart logical 0 -1
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Ignore/Cancel? Ignore
(parted) print
Model: ATA ST16000NM000J-2T (scsi)
Disk /dev/sda: 16.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  16.0TB  16.0TB               logical

(parted) quit
Information: You may need to update /etc/fstab.

root@home:/dev# ls /dev/sd*
/dev/sda  /dev/sda1


# ------------------------------------------------- #


root@home:/dev# sudo mkfs.ext4 -F /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
/dev/sda1 alignment is offset by 3072 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Creating filesystem with 3906469639 4k blocks and 488308736 inodes
Filesystem UUID: 32a17ecf-702a-4a5c-8f26-9bef22efb821
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
        2560000000, 3855122432

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

参考

https://blog.csdn.net/weixin_33970449/article/details/92381880

posted @ 2022-12-12 20:13  wosperry  阅读(1221)  评论(0编辑  收藏  举报