Ubuntu外接硬盘启动后无法访问及恢复上次创建的文件夹
Hey there, I’ve run into this exact issue before with live external Ubuntu setups—super frustrating when your work disappears after a reboot! Let’s walk through the most likely causes and how to fix them:
Why This Happens
The biggest culprit is usually that your external drive is running in read-only Live Mode by default. When you boot Ubuntu from a standard live USB/external drive, all changes (folders, files, settings) are stored in temporary memory, not on the actual drive. They get wiped as soon as you shut down or reboot. Other possible issues include incorrect mounting or incompatible partition formats.
Step-by-Step Fixes
1. Create a Persistent Storage Partition
If you want your changes to stick across reboots, you need to set up a persistent storage partition when creating your external Ubuntu drive:
- Use tools like Rufus or UNetbootin. When configuring the drive, look for an option like "Persistent Partition Size" (e.g., allocate 20GB or more depending on your needs).
- This partition acts as a "save area" for all your files and system changes—they’ll still be there after you reboot.
2. Verify and Correct Mounting
Sometimes files get saved to temporary system directories instead of your external drive:
- Open a terminal and run
lsblkto identify your external drive’s partition (it’ll look like/dev/sdb2or similar, depending on your setup). - Check where it’s mounted with
df -h. If your files are saved outside/media/ubuntu/[your-drive-name], they’re in temporary memory. - To manually mount the drive properly:
Save all your files tosudo mkdir /mnt/external-drive sudo mount /dev/sdb2 /mnt/external-drive # Replace with your actual partition path/mnt/external-drivefrom now on—this ensures they’re written directly to the hard drive.
3. Fix Partition Format Issues
If your external drive uses NTFS, Ubuntu might have trouble writing to it consistently:
- Install the NTFS driver first:
sudo apt update && sudo apt install ntfs-3g - For better compatibility with Ubuntu, consider formatting a dedicated partition to EXT4 (back up your data first!):
sudo mkfs.ext4 /dev/sdb2 # Double-check the partition path to avoid wiping the wrong drive!
4. Ensure Data is Written to the Drive Before Rebooting
Sometimes data stays in cached memory and doesn’t get written to the drive before rebooting:
- After saving files, run this command in the terminal to force cached data to be written:
sync - Always eject the external drive safely (right-click it in the file manager and select "Eject") before rebooting to avoid data loss.
Final Notes
Make sure to back up any important data before making changes to partitions or reformatting—better safe than sorry! Once you set up persistent storage or fix the mounting issue, your files should stay put across reboots.
内容的提问来源于stack exchange,提问作者Neha Tyagi

