AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 726071
Accepted
Olumide
Olumide
Asked: 2016-01-27 17:06:06 +0800 CST2016-01-27 17:06:06 +0800 CST 2016-01-27 17:06:06 +0800 CST

从 Live USB 修复损坏的安装而不丢失数据

  • 772

我最近破坏了我的安装,我尝试使用 apt-get 和他所有的朋友修复它,但徒劳无功。现在我正在尝试使用 live USB,但我不确定如何继续。而且我非常不想损坏我现有的 Windows 7 安装或我的 Linux 配置文件。

一开始我不知道我应该选择哪个安装选项

在此处输入图像描述

我已经尝试过其他选项,但我不知道应该选择哪个分区。无论我选择哪个选项,我都会收到错误消息no root filesystem

在此处输入图像描述 在此处输入图像描述

请指教。

更新

我选择了 /dev/sdb1 ,然后选择了更改按钮,以便将挂载点选择为 / 现在我可以继续但出现警告

在此处输入图像描述

当我继续时,我得到了更可怕的对话(在我做一些我会后悔的事情之前停在这里)

在此处输入图像描述

**更新 2 **

我试图走不那么可怕的路线并尝试启动修复盘。这是我的粘贴箱

system-installation
  • 8 8 个回答
  • 89234 Views

8 个回答

  • Voted
  1. Nodak
    2016-01-27T20:21:42+08:002016-01-27T20:21:42+08:00

    使用 gparted,缩小/dev/sdb1到 32GB。对于典型的根分区来说,它有足够的空间,它不会挤满你当前的情况,并且会为/home.

    虽然重新分区并非没有风险,但在 20 年和数十次重新分区中,我从未遇到过问题。查看如何调整分区大小?为指针。

    /dev/sdb3从第一个分区的其余部分创建分区。

    这种方法(单独的分区)的一个优点是,如果您希望将来更改分布,几乎没有什么戏剧性的事情。这几乎就像换衬衫一样。您的所有个人数据都将在另一个分区上。新系统可以高兴地写入旧的根分区。

    使用您的 GUI 或使用标准做法的命令行安装两个分区,例如 如何从终端访问 USB 闪存驱动器?

    如果您使用的是 GUI,则可能会遇到权限问题,除非您使用超级用户 (root) GUI。分区将安装在类似的地方/media/{LiveCD_user}/{UUID of dev-sdb1}/home/{old_user_id}并将其复制/移动到/media/LiveCD_user/{UUID of dev-sdb3/old_user_data. 命令行不那么戏剧化。

    请遵循以下程序:

    1. 制作两个挂载点:

      sudo mkdir /media/ubuntu_root  /media/new_home
      

      随便称呼他们,名字只是为了您的利益。

    2. 在系统中挂载两个新分区

      sudo mount /dev/sdb1 /media/ubuntu_root
      sudo mount /dev/sdb3 /media/new_home
      
    3. 将旧主目录移动到新分区

      sudo mv /media/ubuntu_root/home/{old_user_id} /media/new_home/old_user_data
      
    4. 数据移动后卸载分区,安装时不提醒。

      sudo umount /dev/sdb1
      sudo umount /dev/sdb3
      
    5. 启动安装程序并使用 *Something else 选项安装新系统。

    6. 选择/dev/sb1作为 root/并☑勾选格式化分区。

    7. 选择/dev/sdb3为/home并且不格式化此分区(它包含您的所有数据)。

    8. 您以前安装过双引导,但请小心使用 GRUB。仔细检查这方面。

    9. 安装。(使用相同的user_id规避任何不可预见的所有权问题)。

    10. 尘埃落定后,启动新系统,然后将所需的数据从新位置拖到/home/old_user_data新位置。

    11. 完成后删除剩菜。

    • 10
  2. TechMod
    2016-01-27T19:58:01+08:002016-01-27T19:58:01+08:00

    制作另一个带有 gparted live 的 USB 棒。从 ot 启动并启动该工具。然后选择将 sdb1 缩小 30Gib 左右。您不会以这种方式丢失数据。

    然后重新启动到您的实时媒体并安装第一个答案中提到的根分区。

    Gparted 能够在不破坏数据的情况下收缩分区,因为它将数据推到分区的开头。

    另一种方法是启动您的实时系统并从您的 /home 分区制作一个 .tar.gz 存档。然后重新安装 ubuntu 并将你的 /home 解压到 /home。

    • 2
  3. Raphael
    2016-01-31T06:58:31+08:002016-01-31T06:58:31+08:00

    从这种混乱中恢复过来的一种方法是在备份所有内容以及已安装的应用程序列表之后重新安装 Ubuntu。

    这是执行此操作的分步方法:

    • 下载Ubuntu。如果你已经有了,*.iso那么你可以跳过这一步。

    • 接下来,将 iso 刻录到您的随身碟或 CD/DVD。

      • 要将其刻录到您的 pendrive,您可以使用以下软件:

        • Rufus - 如果您在 Windows 环境中刻录它。

        • Unetbootin - 如果您在 Linux 环境中刻录它。

      • 要将其刻录到您的 CD/DVD,您可以使用以下软件:

        • K3B - 如果您在 Linux 环境中刻录它。

        • Imgburn - 如果您在 Windows 环境中刻录它。

    • 现在,启动进入 Ubuntu 的实时环境。此步骤的操作方法太长,并且因系统而异,因此,出于明显的原因,我将跳过它。

    • 现在要做的第一件事是挂载包含您之前安装的 Ubuntu 的分区:

      • 要执行该类型:

        sudo mount /dev/sdaXY /mnt
        

        将 XY 更改为您的规格。

      • 此外,将要进行备份的驱动器安装到其中。

    • 接下来,将所有数据复制/mnt/path/to/your/important_folders到/path/to/your/mounted_backup_drive

      • 如果您在复制时遇到任何问题,请尝试使用sudo. 稍后,您可以更改这些文件夹的权限。
    • 接下来,制作当前安装的软件的备份副本:

      • 在这里,是一种如何做到这一点的方法:

        find /mnt/var/lib/dpkg/info/ -name "*.list"  -type f -printf "%P\n" |  awk -F'.' '{print $1}' > /path/to/your/mounted_backup_drive/backup-list.txt
        

        编辑相关部分。

    • 接下来,备份您当前的 ppa 列表。这是如何做到这一点的。

    • 现在,您可以毫无问题地格式化您的 Ubuntu 分区。重新安装后,恢复您的 ppas,然后从上述生成的列表中更新并安装您以前安装的所有软件包。

    • 2
  4. Organic Marble
    2016-01-27T17:17:03+08:002016-01-27T17:17:03+08:00

    您的 Ubuntu 系统似乎在 sdb1 上。对于其他安装,单击 sdb1 并单击更改按钮。在 Use as: 旁边的下拉框中选择 ext4 并勾选该框以格式化分区。在 Mount Point 旁边的下拉框中,选择 /。然后单击确定并立即安装。

    ****** 警告* 这将吹走 sdb1 上剩余的任何内容。* 因此,您将丢失 Ubuntu 安装中未备份的所有数据。

    • 1
  5. Gerhard Stein
    2016-01-27T19:32:56+08:002016-01-27T19:32:56+08:00

    如果你想挽救你的系统状态而不是删除任何东西,你应该尝试使用引导修复盘:引导修复盘

    它在很多这样的情况下帮助了我,也许它可以恢复你的东西。在尝试删除您可能不必删除的内容之前先尝试一下...

    • 1
  6. Manikanta Raju
    2016-02-02T02:47:19+08:002016-02-02T02:47:19+08:00

    引导修复仅修复您的 mbr 而不是操作系统

    因此,如果您的根分区中有数据将被完全擦除,因此将数据从根分区复制到其他外部设备或安装 ntfs 分区的 dev/sda1 分区

    让我们让它变得非常简单

    1)选择其他东西

    2) 右键单击​​ /dev/sba2 并删除分区

    3) 右键单击​​ /dev/sba1 并删除分区

    4)现在您可以获得大约 32gb 的可用空间

    5)现在选择可用空间并单击根分区的+图标(*确保您选择可用空间)

    i) 然后创建分区窗口

    大小为 15360
    用作 ext4
    挂载点 / (root)
    单击确定

    ii) 再次单击可用空间并创建交换分区

    大小为 4096(您的 ram 大小就足够了)
    用作交换区域
    单击确定

    iii)再次单击可用空间并制作主分区

    大小作为任何剩余
    的用作 ext4
    挂载点 /home
    单击确定

    现在你会得到一个提示,提示 /(root) 和交换区分区将被格式化,单击是,然后放松,直到安装完成。

    • 1
  7. 09eragera09
    2016-02-03T16:28:59+08:002016-02-03T16:28:59+08:00

    如果您已经放弃修复,只想取回数据并重新安装 Ubuntu,那么您有 2 个选择

    • 要么按照@Techmod 的建议去做,即启动到 LiveUSB,运行 Gparted 并缩小/dev/sdb1大约 30-40GB,然后在上面安装 Ubuntu(会出现那个可怕的对话框,但请阅读标题。它只是请求写入分区的权限。它不会做任何您不希望它做的事情,前提是您没有意外勾选任何格式复选框,因此请务必仔细检查。),然后备份数据/安装该分区。这是更直接和更容易的方法,并且不需要太多时间。
    • 如果您不喜欢对 HDD 做可怕的事情,那么对 USB 驱动器进行操作怎么样?你可以制作一个 Ubuntu-on-a-stick 类型的东西。以下是有关如何执行此操作的说明。(为此,您需要 2 个 USB 驱动器。一个用于 LiveUSB,一个用于安装。安装驱动器应至少为 8GB。)

      • (我假设你已经有一个 LiveUSB 并且可以启动它,并且已经从第二个 USB 驱动器备份了重要数据)首先,启动到 LiveUSB。当它为您提供安装选项时,请选择安装。
      • 插入第二个 USB 驱动器,我之前称之为“安装驱动器”的驱动器。

      • 回到安装程序,选择所有设置,例如系统区域设置、位置、时间标准和所有这些东西。

      • 当它要求您选择安装类型时,选择“其他”,然后按继续。它应该带您进入您之前看到的分区菜单。
      • Now, instead of selecting any of those, Run Gparted and look for your 2nd USB drive. If what I'm thinking is right, the LiveUSB should be named /dev/sdc/ and the 'install drive' (the 2nd USB Drive) should be /dev/sdd/ but don't take my word for it, ALWAYS DOUBLE CHECK. One single mistake can wreck the whole install.
      • After you have confirmed which mount point the 2nd drive, 'install drive' is in, called /dev/sdd/ from here on out, go back to the installer and make the /dev/sdd partition the / (root) partition, and select /dev/sdd/ to be the bootloader from the drop down menu at the bottom.
      • Double Check everything.
      • Click on 'Install Now'. It will ask for permission (those scary dialog boxes). Select 'Continue' on both of them. It will start installing. Let it install, do whatever you want while it installs.
      • After it has installed, shut down the LiveUSB, remove it from your PC, and boot from the 2nd USB drive, the 'install drive'. Voila! You have a portable persistence Ubuntu. You can carry it around, you can boot into any PC you want with it, and your files will be there.
      • We aren't done yet. To make it feel more like home, to make it more usable for you, we need to change some stuff in the fstab. First, Go into Gparted, and look for the HDD partitions that you have your stuff in, the partitions which you want to mount. Write them down somewhere, paper will do.
      • Go into a terminal, type sudo nano /etc/fstab and execute it. It should give you a editable text editor inside the terminal. It should have some scary numbers, but fear not. As long as you do what I tell you to do, you should have a working system by the end of this tutorial.
      • After the last line, Press enter and get into a new, clear, empty line. Type this code into it, filling in the space as required. <The drive location that you wrote onto paper a while ago> <The place you want it to open from, preferably somewhere in /mnt/> <ext4 or ntfs, the former for a linux partition, the latter for a windows one.> noatime,defaults 0 0 It should look something like this /dev/sdc1/ /mnt/Win7Stuff/ ntfs noatime,defaults 0 0 for a windows partition. After doing this for both the old Ubuntu Partition and the windows one, press CTRL+X and then press Y and then press enter twice.
      • Then type into the terminal sudo mkdir <whatever the /mnt/ directories you mounted them at, such as /mnt/Win7Stuff/. Do it for both the /mnt/ folders.
      • then type sudo mount -a into the terminal and press enter. And Voila! Your PC back~. You can backup everything you need.
      • 哦,另外,我建议也将其添加noatime到/安装点,/etc/fstab/因为它会增加 USB 寿命。

    如果您有任何问题,请发表评论,我要睡觉了,因为它是早上 6 点。晚安。另外,请告诉我,你为什么要给 SWAP 30GIGS OF SPACE?!

    • 1
  8. Best Answer
    Olumide
    2016-02-06T07:35:14+08:002016-02-06T07:35:14+08:00

    根据从用户@hbdgaf 在聊天中收到的建议,通过简单地重新安装并在此过程中创建另一个帐户来解决问题。在此之后,我恢复了我的旧帐户。尽管如此,仍然必须重新安装大多数应用程序。

    PS:在重新安装时还必须修复 inode。所以我想这就是早期修复安装的尝试所阻挠的。

    • 1

相关问题

  • Wubi 和常规的“Windows 旁边”安装有什么区别?

  • 如何在 Windows 7 中运行 Ubuntu?

  • 您对台式机和家庭服务器的驱动器分区方案有什么建议?[关闭]

  • 安装时,我可以选择加密我的主文件夹——这是做什么的?

  • 在不使用标准升级系统的情况下升级有哪些替代方案?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve