日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux下安装新硬盘并挂载mount

發布時間:2025/3/13 linux 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下安装新硬盘并挂载mount 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、過程步驟:

1、首先是添加新硬盤,本人是在虛擬機下添加的:VM >>Settings >> Hardware >> Add >> Hard Disk >> 一路默認。。。

2、fdisk -l ? ?//查看是否找到新硬盤,查看硬盤代號。

3、fdisk /dev/sdb ? ?//找到代號為sdb的新硬盤(創建分區sdb1)

4、mkfs.ext4 ?/dev/sdb1 ? ? //把新硬盤格式化成ext4文件系統

5、mkdir disk2 ? //創建新的掛載點(一般cd到/mnt目錄下進行創建)

6、mount /dev/sdb1 ? /disk2 ? //手動掛載分區,把硬盤掛到/disk2目錄下

7、vi /etc/fstab ? ? 進入編輯模式,添加 /dev/sdb1 ? /disk2 ?ext4 ? auto ?1 ? 2 ?//設置為開機自動掛載分區


二.詳細過程


2、
查看硬盤代號
[root@AMD-LINUX ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×0007d856


Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1305 10281600 8e Linux LVM


Disk /dev/sdb: 2147 MB, 2147483648 bytes <=新硬盤
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×00000000


Disk /dev/sdb doesn’t contain a valid partition table


Disk /dev/dm-0: 9395 MB, 9395240960 bytes
255 heads, 63 sectors/track, 1142 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×00000000


Disk /dev/dm-0 doesn’t contain a valid partition table


Disk /dev/dm-1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×30307800


Disk /dev/dm-1 doesn’t contain a valid partition table
3、fdisk 分區
[root@AMD-LINUX ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0×623223a1.
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 0×0000 of partition table 4 will be corrected by w(rite)


Command (m for help): p <=顯示信息


Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×623223a1


Device Boot Start End Blocks Id System


Command (m for help): n <=新建分區
Command action
e extended
p primary partition (1-4)
p <=新建主分區
Partition number (1-4): 1 <=分區號為1,即/dev/sdb1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261輸入給定范圍的最大值,即把全部全部空間給該分區


Command (m for help): p <=顯示分區信息


Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×623223a1


Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux


Command (m for help): w <=保存退出
The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.
4、創建掛載點
[root@AMD-LINUX ~]# mkdir /disk2


[root@AMD-LINUX ~]# fdisk -l


Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×0007d856


Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1305 10281600 8e Linux LVM


Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×623223a1


Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux


Disk /dev/dm-0: 9395 MB, 9395240960 bytes
255 heads, 63 sectors/track, 1142 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×00000000


Disk /dev/dm-0 doesn’t contain a valid partition table


Disk /dev/dm-1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×30307800


Disk /dev/dm-1 doesn’t contain a valid partition table


[root@AMD-LINUX ~]# mkfs.ext4 ?/dev/sdb1 ? ??=>? //把新硬盤格式化成ext4文件系統 ?
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524112 blocks
26205 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912


Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.




5、設置為開機自動掛載分區
[root@AMD-LINUX ~]# vi /etc/fstab
/dev/sdb1 ? ? /disk2 ? ? ?ext3 ? ? ? auto ? ? 1 2


6、手動掛載分區
[root@AMD-LINUX ~]# mount /dev/sdb1 /disk2/



轉載于:https://www.cnblogs.com/yjtx/p/4429622.html

總結

以上是生活随笔為你收集整理的linux下安装新硬盘并挂载mount的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。