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

输了密码后进去了,但提示是 修复文件系统。

相关内容

    暂无相关文章