本文主要是介绍20231213给Ubuntu18.04.6LTS新加一块HDD机械硬盘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
20231213给Ubuntu18.04.6LTS新加一块HDD机械硬盘
2023/12/13 22:50
rootroot@rootroot-X99-Turbo:~$ cat /etc/issue
Ubuntu 18.04.6 LTS \n \l
sudo fdisk -l
rootroot@rootroot-X99-Turbo:~$
rootroot@rootroot-X99-Turbo:~$ sudo fdisk -lu
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 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
sudo mkfs -t ext4 /dev/sdb
rootroot@rootroot-X99-Turbo:~$ df -l
rootroot@rootroot-X99-Turbo:~$ df -h
rootroot@rootroot-X99-Turbo:~/3TB$ ls -l /dev/disk/by-uuid/
lrwxrwxrwx 1 root root 15 12月 13 18:50 1EA81334A8130A43 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 9 12月 13 19:02 275a607b-41c4-465a-8786-dbddd50fdde1 -> ../../sda
lrwxrwxrwx 1 root root 15 12月 13 18:50 3E8F-C18C -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 12月 13 18:50 684affcc-c9d6-49e9-a59f-fae6fed920e4 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 15 12月 13 18:50 79a6d6b6-2dba-4c71-8e5b-ed0bfccdf0c5 -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 12月 13 18:50 a7df407a-5110-406f-bd60-22150fbcc79b -> ../../nvme0n1p7
lrwxrwxrwx 1 root root 15 12月 13 18:50 ab3419af-9a42-4d3c-b9aa-993bb740dd3b -> ../../nvme0n1p5
# 创建要挂载的文件夹
rootroot@rootroot-X99-Turbo:~$ mkdir 3TB
rootroot@rootroot-X99-Turbo:~$ sudo chmod 777 3TB
rootroot@rootroot-X99-Turbo:~$ sudo chmod 777 3TB
rootroot@rootroot-X99-Turbo:~$ sudo chown rootroot.rootroot 3TB
# 挂载硬盘到该文件夹上
mount /dev/sda /home/rootroot/3TB
rootroot@rootroot-X99-Turbo:~$ sudo blkid /dev/sda
/dev/sda: UUID="275a607b-41c4-465a-8786-dbddd50fdde1" TYPE="ext4"
rootroot@rootroot-X99-Turbo:~$
# 进入 fstab 修改配置
vim /etc/fstab
# 在最后面加入指定信息
UUID=67E91005-EB18-4E24-8410-EB9A1C2E3882 /data ext4 defaults 0 0
rootroot@rootroot-X99-Turbo:/etc$ sudo chmod 777 fstab
echo "UUID=/dev/sdb1 /data1 ext4 defaults 0 0" >> /etc/fstab
echo "UUID=275a607b-41c4-465a-8786-dbddd50fdde1 /home/rootroot/3TB ext4 defaults 0 0" >>/etc/fstab
rootroot@rootroot-X99-Turbo:~$
rootroot@rootroot-X99-Turbo:~$ cat /etc/issue
Ubuntu 18.04.6 LTS \n \l
rootroot@rootroot-X99-Turbo:~$
rootroot@rootroot-X99-Turbo:~$ sudo fdisk -lu
[sudo] password for rootroot:
Disk /dev/loop0: 349.7 MiB, 366682112 bytes, 716176 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
Disk /dev/loop1: 349.7 MiB, 366678016 bytes, 716168 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
Disk /dev/loop2: 1.6 MiB, 1617920 bytes, 3160 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
Disk /dev/loop3: 40.9 MiB, 42827776 bytes, 83648 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
Disk /dev/loop4: 812 KiB, 831488 bytes, 1624 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
Disk /dev/loop5: 4 KiB, 4096 bytes, 8 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
Disk /dev/loop6: 804 KiB, 823296 bytes, 1608 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
Disk /dev/loop7: 73.9 MiB, 77492224 bytes, 151352 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
Disk /dev/nvme0n1: 1.8 TiB, 2000398934016 bytes, 3907029168 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: gpt
Disk identifier: A04A57C4-8AD6-4754-AA51-4D184197F029
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 206847 204800 100M EFI System
/dev/nvme0n1p2 206848 239615 32768 16M Microsoft reserved
/dev/nvme0n1p3 239616 620394279 620154664 295.7G Microsoft basic data
/dev/nvme0n1p4 620394496 621481983 1087488 531M Linux filesystem
/dev/nvme0n1p5 621481984 637536255 16054272 7.7G Linux swap
/dev/nvme0n1p6 637536256 3809372159 3171835904 1.5T Linux filesystem
/dev/nvme0n1p7 3809372160 3905075199 95703040 45.7G Linux filesystem
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 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 /dev/loop8: 497 MiB, 521121792 bytes, 1017816 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
rootroot@rootroot-X99-Turbo:~/3TB$
rootroot@rootroot-X99-Turbo:~/3TB$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 32G 0 32G 0% /dev
tmpfs 6.3G 3.7M 6.3G 1% /run
/dev/nvme0n1p7 45G 14G 30G 32% /
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/loop0 486M 486M 0 100% /snap/gnome-42-2204/126
/dev/loop1 896K 896K 0 100% /snap/gnome-logs/121
/dev/loop2 512K 512K 0 100% /snap/gnome-characters/791
/dev/loop3 219M 219M 0 100% /snap/gnome-3-34-1804/90
/dev/loop4 41M 41M 0 100% /snap/snapd/20092
/dev/loop6 92M 92M 0 100% /snap/gtk-common-themes/1535
/dev/loop5 1.5M 1.5M 0 100% /snap/gnome-system-monitor/184
/dev/loop7 1.7M 1.7M 0 100% /snap/gnome-system-monitor/186
/dev/nvme0n1p4 506M 126M 343M 27% /boot
/dev/nvme0n1p1 96M 30M 67M 31% /boot/efi
/dev/loop9 64M 64M 0 100% /snap/core20/1974
/dev/loop8 350M 350M 0 100% /snap/gnome-3-38-2004/143
/dev/loop10 41M 41M 0 100% /snap/snapd/20290
/dev/nvme0n1p6 1.5T 1.1T 291G 80% /home
/dev/loop11 219M 219M 0 100% /snap/gnome-3-34-1804/93
/dev/loop12 896K 896K 0 100% /snap/gnome-logs/119
/dev/loop13 128K 128K 0 100% /snap/bare/5
/dev/loop14 64M 64M 0 100% /snap/core20/2015
/dev/loop15 512K 512K 0 100% /snap/gnome-characters/795
/dev/loop16 66M 66M 0 100% /snap/gtk-common-themes/1515
/dev/loop17 497M 497M 0 100% /snap/gnome-42-2204/141
/dev/loop18 75M 75M 0 100% /snap/core22/1033
/dev/loop19 74M 74M 0 100% /snap/core22/864
/dev/loop20 56M 56M 0 100% /snap/core18/2796
/dev/loop21 56M 56M 0 100% /snap/core18/2812
/dev/loop22 350M 350M 0 100% /snap/gnome-3-38-2004/140
/dev/loop23 2.3M 2.3M 0 100% /snap/gnome-calculator/953
/dev/loop24 2.3M 2.3M 0 100% /snap/gnome-calculator/955
tmpfs 6.3G 36K 6.3G 1% /run/user/1000
/dev/sda 2.7T 28K 2.6T 1% /home/rootroot/3TB
rootroot@rootroot-X99-Turbo:~/3TB$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 15 12月 13 18:50 1EA81334A8130A43 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 9 12月 13 19:02 275a607b-41c4-465a-8786-dbddd50fdde1 -> ../../sda
lrwxrwxrwx 1 root root 15 12月 13 18:50 3E8F-C18C -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 12月 13 18:50 684affcc-c9d6-49e9-a59f-fae6fed920e4 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 15 12月 13 18:50 79a6d6b6-2dba-4c71-8e5b-ed0bfccdf0c5 -> ../../nvme0n1p6
lrwxrwxrwx 1 root root 15 12月 13 18:50 a7df407a-5110-406f-bd60-22150fbcc79b -> ../../nvme0n1p7
lrwxrwxrwx 1 root root 15 12月 13 18:50 ab3419af-9a42-4d3c-b9aa-993bb740dd3b -> ../../nvme0n1p5
rootroot@rootroot-X99-Turbo:~/3TB$
rootroot@rootroot-X99-Turbo:~/3TB$
参考资料:
百度:Ubuntu环境下挂载新硬盘
https://zhuanlan.zhihu.com/p/666997493
Ubuntu挂载新硬盘
https://zhuanlan.zhihu.com/p/388362234
Linux Ubuntu 硬盘挂载方法
# 创建要挂载的文件夹
mkdir /data
# 挂载硬盘到该文件夹上
mount /dev/sde /data
rootroot@rootroot-X99-Turbo:~$ sudo blkid /dev/sda
/dev/sda: UUID="275a607b-41c4-465a-8786-dbddd50fdde1" TYPE="ext4"
rootroot@rootroot-X99-Turbo:~$
# 进入 fstab 修改配置
vim /etc/fstab
# 在最后面加入指定信息
UUID=67E91005-EB18-4E24-8410-EB9A1C2E3882 /data ext4 defaults 0 0
https://zhuanlan.zhihu.com/p/623064560
ubuntu 挂载新硬盘
https://www.jianshu.com/p/be174d108186
DISK MOUNT
https://blog.csdn.net/qq_33031419/article/details/133056014
如何在Ubuntu中挂载新硬盘
https://blog.csdn.net/qq_19253847/article/details/129198661
Ubuntu系统下如何挂载新硬盘2T及以下/挂载2T以上
10.将硬盘分区信息加入分区信息表,供系统识别。
echo "UUID=/dev/sdb1 /data1 ext4 defaults 0 0" >> /etc/fstab
不建议直接用/dev/sdd等挂载,建议用UUID:
ls -l /dev/disk/by-uuid/ 查看id
这篇关于20231213给Ubuntu18.04.6LTS新加一块HDD机械硬盘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!