克隆磁盘和调整分区大小后启动速度缓慢

JJD*_*JJD 6 boot ubuntu fstab timeout gparted

我最近用更大的 SSD 更换了 SSD。我使用Clonezilla将旧磁盘克隆到新磁盘。之后,我使用GParted Live调整现有分区的大小,将交换分区推到磁盘的末尾。我也从 Ubuntu 16.04 更新到 18.04。

\n\n

成功完成上述步骤后,我注意到启动时间变得更长了。我发现了一些类似的线程(下面链接)并尝试了那里的建议。然而,启动时间并没有减少到更换磁盘之前的时间。

\n\n

这是我的原文/etc/fstab

\n\n
# /etc/fstab: static file system information.\n#\n# Use \'blkid\' to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n# <file system> <mount point>   <type>  <options>       <dump>  <pass>\n# / was on /dev/sda1 during installation\nUUID=e15b2ef7-c32d-46f5-a3a8-4bdc60285b4e /               ext4    errors=remount-ro 0       1\n# swap was on /dev/sda5 during installation\nUUID=3a0c2581-52f2-4c92-9c4a-09d3f0258c05 none            swap    sw              0       0\n/dev/disk/by-id/usb-Generic_USB_Flash_Disk-0:0 /mnt/usb-Generic_USB_Flash_Disk-0:0 auto nosuid,nodev,nofail,x-gvfs-show 0 0\n
Run Code Online (Sandbox Code Playgroud)\n\n

我已经通过查看blkidUUID命令输出替换了分区的:swap

\n\n
/dev/sda1: UUID="e15b2ef7-c32d-46f5-a3a8-4bdc60285b4e" TYPE="ext4" PARTUUID="000d7e8b-01"\n/dev/sda5: LABEL="swap" UUID="839f9d78-77b2-491d-808d-8cd551a9eeef" TYPE="swap" PARTUUID="000d7e8b-05"\n
Run Code Online (Sandbox Code Playgroud)\n\n

我还注释掉了 ,/dev/disk/by-id/usb-..因为我相信这是我启动 GParted Live 的 USB 记忆棒。不知道为什么它仍然在那里定义。

\n\n
/dev/sda1: UUID="e15b2ef7-c32d-46f5-a3a8-4bdc60285b4e" TYPE="ext4" PARTUUID="000d7e8b-01"\n/dev/sda5: LABEL="swap" UUID="839f9d78-77b2-491d-808d-8cd551a9eeef" TYPE="swap" PARTUUID="000d7e8b-05"\n
Run Code Online (Sandbox Code Playgroud)\n\n

显示/var/log/boot.log如下:

\n\n
         Starting Tell Plymouth To Write Out Runtime Data...\n[  OK  ] Started Braille Device Support.\n[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.\n         Starting Load/Save RF Kill Switch Status...\n[  OK  ] Started Braille Device Support.\n[  OK  ] Started Load/Save RF Kill Switch Status.\n[  OK  ] Reached target Sound Card.\n[  OK  ] Started Braille Device Support.\n[  OK  ] Started Tell Plymouth To Write Out Runtime Data.\n[  OK  ] Started Raise network interfaces.\n[ TIME ] Timed out waiting for device dev-disk-by\\x2did-usb\\x2dGeneric_USB_Flash_Disk\\x2d0:0.device.\n[DEPEND] Dependency failed for /mnt/usb-Generic_USB_Flash_Disk-0:0.\n[ TIME ] Timed out waiting for device dev-disk-by\\x2duuid-3a0c2581\\x2d52f2\\x2d4c92\\x2d9c4a\\x2d09d3f0258c05.device.\n[DEPEND] Dependency failed for /dev/disk/by-uuid/3a0c2581-52f2-4c92-9c4a-09d3f0258c05.\n[DEPEND] Dependency failed for Swap.\n[  OK  ] Reached target System Initialization.\n[  OK  ] Listening on UUID daemon activation socket.\n[  OK  ] Listening on PC/SC Smart Card Daemon Activation Socket.\n[  OK  ] Started Daily apt download activities.\n...\n
Run Code Online (Sandbox Code Playgroud)\n\n

systemd -analyze命令告诉我们:

\n\n
Startup finished in 36.037s (kernel) + 10.847s (userspace) = 46.885s\ngraphical.target reached after 10.835s in userspace\n
Run Code Online (Sandbox Code Playgroud)\n\n

我可以采取什么措施来缩短启动时间?

\n\n

更新

\n\n

我今天再次查看/var/log/boot.log并发现了这个输出 - 请注意搜索设备时的超时!:

\n\n
         Starting Tell Plymouth To Write Out Runtime Data...\n[  OK  ] Started Braille Device Support.\n[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.\n         Starting Load/Save RF Kill Switch Status...\n[  OK  ] Started Braille Device Support.\n[  OK  ] Started Load/Save RF Kill Switch Status.\n[  OK  ] Reached target Sound Card.\n[  OK  ] Started Braille Device Support.\n[  OK  ] Started Tell Plymouth To Write Out Runtime Data.\n[  OK  ] Started Raise network interfaces.    \n[*     ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[**    ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[***   ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[ ***  ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[  *** ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[   ***] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[    **] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[     *] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[    **] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[   ***] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[  *** ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[ ***  ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[***   ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[**    ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[*     ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n[**    ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[***   ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[ ***  ] (2 of 2) A start job is running for dev-disk-by\\x2duuid-3a0c2581\\x2d5\n[  *** ] (1 of 2) A start job is running for dev-disk-by\\x2did-usb\\x2dGeneric_\n...\n[ TIME ] Timed out waiting for device dev-disk-by\\x2did-usb\\x2dGeneric_USB_Flash_Disk\\x2d0:0.device.\n[DEPEND] Dependency failed for /mnt/usb-Generic_USB_Flash_Disk-0:0.\n[ TIME ] Timed out waiting for device dev-disk-by\\x2duuid-3a0c2581\\x2d52f2\\x2d4c92\\x2d9c4a\\x2d09d3f0258c05.device.\n[DEPEND] Dependency failed for /dev/disk/by-uuid/3a0c2581-52f2-4c92-9c4a-09d3f0258c05.\n[DEPEND] Dependency failed for Swap.\n[  OK  ] Reached target System Initialization.\n[  OK  ] Listening on UUID daemon activation socket.\n[  OK  ] Listening on PC/SC Smart Card Daemon Activation Socket.\n...\n
Run Code Online (Sandbox Code Playgroud)\n\n

有关的

\n\n\n

sud*_*dus 2

我怀疑有一个“恢复”文件

/etc/initramfs-tools/conf.d/resume
Run Code Online (Sandbox Code Playgroud)

它指向不再找到的 UUID。您可以修改该文件以指向交换分区的正确 UUID,然后运行

sudo update-initramfs -u
Run Code Online (Sandbox Code Playgroud)

请参阅以下错误报告链接中的注释 #16 和 #17,

https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1763611


您的情况与错误报告中的情况存在差异,

  • 在你的情况下,你使用的是交换分区
  • 在错误报告的情况下,使用交换文件(因此没有交换分区,应该指出)。