修复 VMware Workstation Ubuntu Guest 磁盘错误

VMware Workstation 17.6.4 build-24832109 不稳定,几次出错后 Ubuntu Guest 无法正常登录系统。

主要异常为:输入用户和密码后卡在 GUI 的登录界面,使用 fsck 修复分区后问题解决,具体步骤如下:

  1. 菜单:VMWare -> 虚拟机 -> SSH -> 连接到 SSH,弹出 cmd ,输入用户密码后成功登录。

  2. 登录后发现 Ubuntu 系统报错信息。

    Last login: Tue Sep 16 10:37:29 2025 from 127.0.0.1
    Could not chdir to home directory /home/zz: No such file or directory
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.
  3. 查看 /etc/fstab ,/dev/sda3 挂载到 /home,但是没有成功,判断是 /dev/sda3 分区出现磁盘错误。

    # / was on /dev/sda1 during curtin installation
    /dev/disk/by-uuid/3e183a23-6b85-4f4e-bf2b-56db194986c3 / ext4 defaults 0 1
    # /boot/efi was on /dev/sda2 during curtin installation
    /dev/disk/by-uuid/432F-3632 /boot/efi vfat defaults 0 1
    # /home was on /dev/sda3 during curtin installation
    /dev/disk/by-uuid/541b5e10-c371-40df-a980-853d6a6af5dd /home ext4 defaults 0 1
    /swapfile       none    swap    sw      0       0
  4. 修复 /dev/sda3 分区: sudo fsck /dev/sda3 ,修复完成后重启,正常进入 ubuntu guest 系统。

    zz@VM:/$ sudo fsck /dev/sda3
    fsck from util-linux 2.39.3
    e2fsck 1.47.0 (5-Feb-2023)
    /dev/sda3 contains a file system with errors, check forced.
    Pass 1: Checking inodes, blocks, and sizes
    Inodes that were part of a corrupted orphan linked list found.  Fix<y>? yes
    Inode 23855356 was part of the orphaned inode list.  FIXED.
    Inode 23870520 was part of the orphaned inode list.  FIXED.
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    Block bitmap differences:  -(39202343--39202351) -(50175535--50175536)
    Fix<y>? yes
    Free blocks count wrong for group #1196 (627, counted=636).
    Fix<y>? yes
    Free blocks count wrong for group #1531 (182, counted=184).
    Fix<y>? yes
    Free blocks count wrong (53847217, counted=53846886).
    Fix<y>? yes
    Inode bitmap differences:  -23855147 -23855356 -23870520
    Fix<y>? yes
    Free inodes count wrong for group #2912 (1, counted=3).
    Fix<y>? yes
    Free inodes count wrong for group #2913 (0, counted=1).
    Fix<y>? yes
    Free inodes count wrong (25263684, counted=25263646).
    Fix<y>? yes
    
    /dev/sda3: ***** FILE SYSTEM WAS MODIFIED *****
    /dev/sda3: 4473314/29736960 files (0.1% non-contiguous), 65095066/118941952 blocks
    henices@VM:/$
    henices@VM:/$ sudo reboot
    
    Broadcast message from root@VM on pts/1 (Tue 2025-09-23 11:35:12 CST):
    The system will reboot now!
    
    zz@VM:/$ Connection to 192.168.2.128 closed by remote host.
    Connection to 192.168.2.128 closed.

修复 VMware Workstation Ubuntu Guest 磁盘错误
https://usmacd.com/cn/vmware_fix_guest_disk_error/
作者
henices
发布于
2025年9月23日
许可协议