技術文檔
Debian系統 如何手動掛載數據盤?
一、查找磁盤,找到磁盤,物理服務器磁盤名一般為/dev/sda、/dev/sdb、/dev/sdc等等依此類推,云主機、vps類一般為vda、vdb、vdc等等依此類推。
執行命令
fdisk -l
如圖,找到數據盤為/dev/vdb
二、建立分區
執行命令
fdisk /dev/vdb
具體過程如下
root@debyogile:/home/yogile# fdisk /dev/sdb1 Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. # 刪除硬盤原分區 Command (m for help): d Selected partition 1 Partition 1 has been deleted. # 添加硬盤新分區 Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) # 添加分區,默認的分區格式是 primary Select (default p): Using default response p. # 分區號默認 1 Partition number (1-4, default 1): # 指定分區的起始扇區,一般默認 2048 First sector (2048-62668799, default 2048): # 指定分區的終止扇區,一般默認最大值 Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62668799, default 62668799): Created a new partition 1 of type Linux and of size 29.9 GiB. Partition #1 contains a vfat signature. # 詢問刪除簽名,確認:y Do you want to remove the signature? [Y]es/[N]o: y The signature will be removed by a write command. # 保存修改 Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
三、再查看一下硬盤分區信息
可以看到有一個/dev/vdb1
四、格式化文件系統
執行命令
mkfs.ext4 /dev/vdb1
五、建立要掛載到的目錄www
執行命令
mkdir /www
六、掛載數據盤到建立的目錄www
執行命令
mount /dev/vdb1 /www
七、查看掛載是否顯示
執行命令
df -h
八、添加開機自動掛載
查看磁盤的UUID
blkid/dev/sdb會返回/dev/sdb:UUID="xxxxx-xxxxx-xxxxx" TYPE="xxx"
nano/etc/fstab在尾部追加一行UUID,示例:
UUID=271d48fa-7729-4200-848a-b3dfc61135dd /www ext4 defaults 0 0退出并保存:ctrl+x,然后按y,然后直接enter。
重啟以驗證是否成功。
rebootdf -h- 上一篇: Debian 如何修改DNS,設置DNS?
- 下一篇: 如何在Debian 10上使用UFW設置防火墻