恢复tar备份导致Ubuntu 16.04系统崩溃,该如何排查解决?
Hey there, let's figure out why your Ubuntu 16.04 system crashed after restoring your tar backup, and walk through how to fix it. The root cause almost always comes from how the backup was created or how the restore was performed—let's break it down step by step.
Why Your System Crashed
Your backup and restore steps missed critical exclusions and overwrote system-specific files that don't play well with a fresh installation:
- Incomplete backup exclusions: The original backup command didn't exclude virtual/temporary filesystems like
/proc,/sys,/dev,/tmp, and/run. These directories contain dynamic system data generated at boot, not persistent files. Restoring them conflicts with the fresh system's own dynamic files, breaking boot processes. - Overwriting system-critical files: Restoring the entire backup directly to
/overwrote the fresh install's bootloader (grub), kernel, and partition configuration (/etc/fstab). Since you wiped the drive for dual-boot, the partition layout changed—your oldfstabreferences UUIDs that no longer exist, causing mount failures on boot.
Step-by-Step Fixes
1. Boot into Ubuntu Live Mode
Grab your Ubuntu 16.04 installation USB/CD, boot from it, and select "Try Ubuntu without installing". This lets you access your installed system without booting it directly.
2. Mount Your System Partition
First, identify your system partition (usually /dev/sda1 or similar) using lsblk, then mount it:
sudo mkdir /mnt/ubuntu sudo mount /dev/sda1 /mnt/ubuntu
3. Repair the System Configuration
a. Fix the fstab File
The old fstab from your backup is pointing to invalid partitions. Replace it with the fresh install's fstab (you can find a backup in /mnt/ubuntu/etc/fstab~ if it exists, or generate a new one):
# Backup the broken fstab first sudo cp /mnt/ubuntu/etc/fstab /mnt/ubuntu/etc/fstab.broken # Copy the fresh install's backup fstab (if available) sudo cp /mnt/ubuntu/etc/fstab~ /mnt/ubuntu/etc/fstab # If no backup exists, generate a new one using blkid to get current UUIDs blkid # Note the UUID of your system partition sudo nano /mnt/ubuntu/etc/fstab # Replace the old UUID line with something like: # UUID=your-new-uuid / ext4 errors=remount-ro 0 1
b. Reinitiate System Boot Components
Chroot into your mounted system to update the initramfs and grub, which fixes kernel/bootloader mismatches:
sudo mount --bind /dev /mnt/ubuntu/dev sudo mount --bind /proc /mnt/ubuntu/proc sudo mount --bind /sys /mnt/ubuntu/sys sudo chroot /mnt/ubuntu # Update initramfs to fix kernel module issues update-initramfs -u # Update grub to recognize the current partition layout update-grub exit
4. Correct Your Backup Process for Future Use
To avoid this issue next time, use a proper backup command that excludes non-persistent directories:
cd / sudo tar -cvpzf backup.tar.gz \ --exclude=/backup.tar.gz \ --exclude=/proc \ --exclude=/sys \ --exclude=/dev \ --exclude=/tmp \ --exclude=/run \ --exclude=/mnt \ --exclude=/media \ --exclude=/lost+found \ /
When restoring, avoid overwriting /boot, /etc/fstab, and /etc/default/grub unless you're sure the partition layout is identical to the original system.
Verify the Fix
Unmount the partitions and reboot:
sudo umount /mnt/ubuntu/dev sudo umount /mnt/ubuntu/proc sudo umount /mnt/ubuntu/sys sudo umount /mnt/ubuntu sudo reboot
If it still crashes, check the boot logs in /var/log/boot.log or /var/log/syslog from Live Mode to pinpoint specific errors (e.g., driver conflicts, filesystem corruption).
内容的提问来源于stack exchange,提问作者Mohit




