VMware linux系统扩展磁盘
程序员文章站
2022-06-16 21:38:32
...
1.关闭虚拟机,编辑虚拟机,点磁盘,扩展,调整磁盘大小
2.启动虚拟机在root登录
[root@node1 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris
#fdisk /dev/sda #用命令进行分区
WARNING: DOS-compatible mode is deprecated. It s strongly recommended to
switch off the mode (command'c') and change display units to sectors (command'u').Command (m forhelp): n # 输入 n 表示创建新分区
Command action
e extended
p primary partition (1-4) p
Partition number (1-4): 3 # 输入 3 表示sda3,因为前面已经有两个了
First cylinder (1306-4568, default 1306): # 回车,按默认值
Using default value 1306 Last cylinder, +cylinders or +size{K,M,G} (1306-4568, default 4568):
# 回车,按默认值
Using default value 4568 Command (m forhelp): w # 输入 w 保存退出
The partition table has been altered! Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
在次查看
[root@node1 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris
/dev/sda3 2611 3916 10490445 83 Linux
这个分区是新添加出来的
执行格式化命令:mkfs -t ext3 /dev/sda3
出现下面的错误
[root@node1 ~]# mkfs -t ext3 /dev/sda3 mke2fs 1.39 (29-May-2006) Could not stat /dev/sda3 --- No such file or directory The device apparently does not exist; did you specify it correctly?
看看是否安装了 parted包
[root@node1 ~]# rpm -q parted parted-1.8.1-29.el5 parted-1.8.1-29.el5 [root@node1 ~]# partprobe #然后执行这个命令在重新执行格式化 Error: Error opening /dev/md0: No such file or directory [root@node1 ~]# mkfs -t ext3 /dev/sda3
执行格式化后要对磁盘挂在
[root@node1 ~]# mkdir /mnt/ndisk 创建一个挂在点
[root@node1 ~]# mount /dev/sda3 /mnt/ndisk 将刚刚格式化好的进行挂在
[root@node1 ~]# vi /etc/fstab 编辑开机启动文件自动挂在
/dev/sda3 /mnt/ndisk ext3 defaults 1 2
上面的命令不能添加磁盘到根目录的下面