Ubuntu 17.10因恢复文件占满硬盘无法启动,求助解决方案
Hey there, let's work through this problem step by step—you're dealing with two urgent issues right now: getting your Ubuntu 17.10 system back up and running, then trying to recover that deleted Windows 7 VM. Let's start with the boot failure first since that's the most immediate block.
The sudden restart during the Photorec process likely caused file system corruption or left your disk full, which is preventing Ubuntu from booting. Here's how to fix it:
Boot into recovery mode first
When your machine starts, hold down theShiftkey (useEscif you're on a UEFI system) to bring up the GRUB menu. Select Advanced options for Ubuntu, then pick the kernel version labeled with recovery mode. Once in the recovery menu:- Choose
fsck– this tool scans and repairs file system errors, which is probably needed after the forced restart. Confirm the repair when prompted. - If
fsckdoesn't resolve the boot issue, selectrootto enter a root shell. Rundf -hto check disk usage, then delete the Photorec recovery files (they're usually in a folder you specified, e.g.,rm -rf /home/yourusername/photorec_recovered) to free up space. Typeexitand select resume normal boot afterward.
- Choose
Use a live USB if recovery mode fails
Create an Ubuntu 17.10 live USB (use another computer to download the ISO and write it to a USB drive with tools like Etcher). Boot from the USB and select Try Ubuntu without installing:- Open Files, find your Ubuntu system partition, and click to mount it.
- Open a terminal, run
lsblkto identify your system partition (e.g.,/dev/sda1), then runsudo fsck /dev/sda1to repair file system damage. - Navigate to the mounted partition, locate and delete the Photorec recovery folder to free up space.
- Reboot your machine, remove the USB, and check if Ubuntu boots normally.
Now that you can access your system, let's try to get that VM back:
Check VirtualBox's built-in "trash" first
Open VirtualBox, go to the File menu, and select Virtual Media Manager. Switch to the Removed tab – if your Windows 7 VM disk file (.vdior.vmdk) is listed here, right-click it and select Add to restore it to your VM list.Retry Testdisk with enough free space
Make sure you have at least as much free disk space as the size of your original Windows 7 VM. Then:- Install Testdisk if you haven't already:
sudo apt install testdisk - Run
sudo testdisk, select your target disk, choose the correct partition type (usually Intel), then pick Analyze followed by Quick Search. - Locate the partition where you stored the VM file, look for the missing
.vdi/.vmdkfile, mark it asP(Primary), then press Write to save the partition table. Reboot and try accessing the recovered file.
- Install Testdisk if you haven't already:
Optimize Photorec for VM files
If you use Photorec again, narrow down the file types to only VM-related ones to save space and speed up recovery:- Run
sudo photorec, select your disk and partition. - When you reach the File Opt screen, uncheck all file types except
.vdi,.vmdk, and.vhd. - Choose a target directory with enough free space and start the recovery.
- Run
内容的提问来源于stack exchange,提问作者user777865

