歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux下磁盤掛載格式化

Linux下磁盤掛載格式化

日期:2017/2/28 17:35:28   编辑:Linux教程
虛擬機上的 系統磁盤空間不足了的事情很容易發生, 這時可以通過增加虛擬磁盤的方法來擴充空間。

擴充空間後,需要到linux下去 mount一下, 通過一下步驟,就可以用了, 但我感覺奇怪的是, 為什麼一掛載上去, 可用空間就變成0了?

[root@LINUX-AS3 root]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
[root@LINUX-AS3 root]# mount -f ext3 /hd1_dir
[root@LINUX-AS3 root]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
ext3 5573968 5503612 0 100% /hd1_dir
[root@LINUX-AS3 root]# umount ext3
umount: ext3: not found
umount: /hd1_dir: not mounted
[root@LINUX-AS3 root]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
[root@LINUX-AS3 root]# mount -f /dev/hda3 /hd1_dir
[root@LINUX-AS3 root]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
/dev/hda3 5573968 5503612 0 100% /hd1_dir
[root@LINUX-AS3 root]# cd /hd1_dir/
[root@LINUX-AS3 hd1_dir]# ls
[root@LINUX-AS3 hd1_dir]#
[root@LINUX-AS3 hd1_dir]# fdformat
usage: fdformat [ -n ] device
[root@LINUX-AS3 hd1_dir]# fdformat /hd1_dir/
/hd1_dir/: not a block device
[root@LINUX-AS3 hd1_dir]# fdformat /dev/hda3
Could not determine current format type: 無效的參數
[root@LINUX-AS3 hd1_dir]# man fdformat
[root@LINUX-AS3 hd1_dir]#
[root@LINUX-AS3 hd1_dir]# cd /hd1_dir/
[root@LINUX-AS3 hd1_dir]# ls
[root@LINUX-AS3 hd1_dir]# rm -rf *
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
/dev/hda3 5573968 5503612 0 100% /hd1_dir
[root@LINUX-AS3 hd1_dir]# umount /hd1_dir/
umount: /dev/hda3: not mounted
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
[root@LINUX-AS3 hd1_dir]# mount -f /dev/hdb1 /hd1_dir/
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
/dev/hdb1 5573968 5503612 0 100% /hd1_dir
[root@LINUX-AS3 hd1_dir]# umount /hd1_dir/
umount: /dev/hdb1: not mounted
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503612 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
[root@LINUX-AS3 hd1_dir]# mount -f /dev/sda1 /hd1_dir/
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503616 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
/dev/sda1 5573968 5503616 0 100% /hd1_dir
[root@LINUX-AS3 hd1_dir]# mkfs.ext3 /dev/sda1
mke2fs 1.32 (09-Nov-2002)
mkfs.ext3: No such device or address while trying to determine filesystem size
[root@LINUX-AS3 hd1_dir]# df
文件系統 1K-塊 已用 可用 已用% 掛載點
/dev/hda2 5573968 5503616 0 100% /
/dev/hda1 101089 9361 86509 10% /boot
none 72540 0 72540 0% /dev/shm
/dev/sda1 5573968 5503616 0 100% /hd1_dir
[root@LINUX-AS3 hd1_dir]# vi /etc/fstab
[root@LINUX-AS3 hd1_dir]#
[root@LINUX-AS3 hd1_dir]#
[root@LINUX-AS3 hd1_dir]# reboot

輸了密碼後進去了,但提示是 修復文件系統。
Copyright © Linux教程網 All Rights Reserved