Arch-Linux

調整分區大小,安裝和引導系統 Arch 的問題

  • April 13, 2019

我使用 parted 程序來調整我的/home(安裝的)分區的大小。/home有 420 GB(使用 60 GB),我調整到 320 GB(現在是 100 GB 免費)。當我重新啟動電腦時,我無法啟動文件系統檢查並在 Arch 上啟動緊急模式。所以我 umount /dev/sda4(home) 執行fsck /dev/sda4,當我嘗試掛載時,我的 fs 類型錯誤,選項錯誤,/dev/sda4 上的超級塊錯誤,系統仍然不想啟動。

編輯:我需要來自這個分區的數據,也許可以訪問並複制其他分區上最重要的數據並刪除 sda4 ?但我不知道如何訪問這些數據。

lsblk:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
   sda      8:0    0 465.8G  0 disk 
   |-sda1   8:1    0   256M  0 part /boot
   |-sda2   8:2    0     6G  0 part [SWAP]
   |-sda3   8:3    0    40G  0 part /
   `-sda4   8:4    0 419.4G  0 part 
   sr0     11:0    1   742M  0 rom  

dmesg | tail

 [   67.769679] xor: using function: prefetch64-sse (6108.000 MB/sec)
[   67.828384] Btrfs loaded
[  140.029658]  sda: sda1 sda2 sda3 sda4
[  348.916444]  sda: sda1 sda2 sda3 sda4
[  731.875551] EXT4-fs (sda4): bad geometry: block count 109972230 exceeds size of device (85531834 blocks)
[  737.760531] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem
[  737.805255] EXT4-fs (sda1): mounted filesystem without journal. Opts: (null)
[  767.421212] EXT4-fs (sda4): bad geometry: block count 109972230 exceeds size of device (85531834 blocks)
[  769.639095] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[ 2340.076115] EXT4-fs (sda4): bad geometry: block count 109972230 exceeds size of device (85531834 blocks)

日記本

-- Logs begin at Tue 2015-10-27 15:56:01 CET, end at Mon 2016-10-17 17:16:55 CEST. --
Oct 17 17:16:46 iam systemd-journald[146]: Runtime journal (/run/log/journal/) is 8.0M, max 285.7M, 277.7M free.
-- Subject: Disk space used by the journal
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Runtime journal (/run/log/journal/) is currently using 8.0M.
-- Maximum allowed usage is set to 285.7M.
-- Leaving at least 428.6M free (of currently available 2.7G of disk space).
-- Enforced usage limit is thust 17 17:16:47 iam kernel: Urtc0

-- The start-up result is done.
Oct 17 17:16:54 iam systemd-fsck[374]: /dev/sda4: The filesystem size (according to the superblock) is 109972230 blocks
Oct 17 17:16:54 iam systemd-fsck[374]: The physical size of the device is 109945896 blocks
Oct 17 17:16:54 iam systemd-fsck[374]: Either the superblock or the partition table is likely to be corrupt!
Oct 17 17:16:54 iam systemd-fsck[374]: /dev/sda4: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Oct 17 17:16:54 iam systemd-fsck[374]:         (i.e., without -a or -p options)
Oct 17 17:16:54 iam systemd-fsck[374]: fsck failed with error code 4.
Oct 17 17:16:54 iam systemd-fsck[374]: Running request emergency.target/start/replace
Oct 17 17:16:54 iam systemd[1]: Mounting /boot...
-- Subject: Unit boot.mount has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit boot.mount has begun starting up.
Oct 17 17:16:54 iam systemd[1]: systemd-fsck@dev-sda4.service: Main process exited, code=exited, status=1/FAILURE
Oct 17 17:16:54 iam systemd[1]: Failed to start File System Check on /dev/sda4.
-- Subject: Unit systemd-fsck@dev-sda4.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-fsck@dev-sda4.service has failed.
-- 
-- The result is failed.
Oct 17 17:16:54 iam systemd[1]: Dependency failed for /home.
-- Subject: Unit home.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit home.mount has failed.


-- The result is dependency.
Oct 17 17:16:54 iam systemd[1]: local-fs.target: Job local-fs.target/start failed with result 'dependency'.
Oct 17 17:16:54 iam systemd[1]: local-fs.target: Triggering OnFailure= dependencies.
Oct 17 17:16:54 iam systemd[1]: home.mount: Job home.mount/start failed with result 'dependency'.
Oct 17 17:16:54 iam systemd[1]: systemd-fsck@dev-sda4.service: Unit entered failed state.
Oct 17 17:16:54 iam systemd[1]: systemd-fsck@dev-sda4.service: Failed with result 'exit-code'.
Oct 17 17:16:54 iam systemd[1]: Reached target Network.
-- Subject: Unit network.target has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel


-- Userspace start-up required 11995553 microseconds.
Oct 17 17:16:55 iam systemd[468]: emergency.service: Failed at step EXEC spawning /bin/plymouth: No such file or directory
-- Subject: Process /bin/plymouth could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /bin/plymouth could not be executed and failed.
-- 
-- The error number returned by this process is 2.

blkid

/dev/sda1: UUID="a60f7835-d787-4794-889e-1229c3788b5a" TYPE="ext2" PARTUUID="e10910a7-01"
/dev/sda2: UUID="4d2bdad8-2c4f-45de-bc11-c02a690d2bdf" TYPE="swap" PARTUUID="e10910a7-02"
/dev/sda3: UUID="a17f1309-204d-4aea-abda-7ef7e1dcae05" TYPE="ext4" PARTUUID="e10910a7-03"
/dev/sda4: UUID="af1e2c37-517c-4d5c-8a0e-76d67b1b84ca" TYPE="ext4" PARTUUID="e10910a7-04"
/dev/sr0: UUID="2016-08-01-16-33-35-00" LABEL="ARCH_201608" TYPE="iso9660" PTUUID="38ab083f" PTTYPE="dos"
/dev/sdb1: UUID="2016-06-11-19-19-51-00" LABEL="MJRO1606" TYPE="iso9660" PTUUID="62cadc67" PTTYPE="dos" PARTUUID="62cadc67-01"
/dev/sdb2: SEC_TYPE="msdos" LABEL="MISO_EFI" UUID="F6E9-DC96" TYPE="vfat" PARTUUID="62cadc67-02"

問題是您在沒有先調整文件系統大小的情況下調整了分區的大小,因此您將文件系統的一部分切掉了,現在它處於文件系統記錄說它比實際更大的狀態,並且想著其餘的東西有故障,實際上不存在。

一種可能的解決方案是將您的分區恢復到其原始大小,但我不是在談論 GiB 大小,它必須e2fsck與實際工作的塊大小完全相同,所以如果分區的其餘部分是,這應該沒問題仍然沒有改變,只是再次將其增長到最大。

一旦分區是它的原始大小執行e2fsck -f /dev/sda4,現在該工具應該修復您的文件系統。現在修復後,首先使用收縮文件系統resize2fs,在收縮 FS 之後,您可以將分區收縮到與收縮 FS 完全相同的大小。

但是我有一些壞消息要告訴你,因為你調整了分區而不是文件系統的大小,一些文件可能已經在擦除的部分,並且可能會失去。

引用自:https://unix.stackexchange.com/questions/316972