如何手動寫入/etc/fstab?

如何手動寫入/etc/fstab?

我不小心刪除了我的 /etc/ 目錄。這是我的安裝盤 -

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5401B3C5-4DA4-4F2D-BB2B-F1845E8E8E4F

Device       Start        End    Sectors   Size Type
/dev/sda1     2048    1050623    1048576   512M EFI System
/dev/sda2  1050624    2050047     999424   488M Linux filesystem
/dev/sda3  2050048 1953523711 1951473664 930.5G Linux filesystem

ubuntu@ubuntu:~$ ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 160 Jun  9 03:18 .
drwxr-xr-x 8 root root 160 Jun  9 03:07 ..
lrwxrwxrwx 1 root root  10 Jun  9 03:08 64490475-1baf-4a81-a7be- 87f617f51228 -> ../../sda2                        
lrwxrwxrwx 1 root root  10 Jun  9 03:08 D378-4726 -> ../../sda1
lrwxrwxrwx 1 root root  10 Jun  9 03:18 db611ff4-b7e6-41ad-935b-d70ee56a30ac -> ../../sda3

lrwxrwxrwx 1 root root  10 Jun  9 03:18 dc7811ca-4 c11-4547-9971-49ef2409989f -> ../../dm-1
lrwxrwxrwx 1 root root  10 Jun  9 03:08 6895-5744 -> ../../sdb1
lrwxrwxrwx 1 root root  10 Jun  9 03:18 a4774c86-924b-425f-a6ef-3cba2d2cb24a -> ../../dm-2

我不想重新安裝。我有一個實時 USB。我想手動編寫 /etc/fstab 檔案以使我的系統至少能夠啟動。條目應該是什麼?

答案1

你應該看看這個回答使用extundelete。正如評論中所說,僅使用 fstab 無法讓您的系統恢復正常!

如果還不算太晚,請嘗試還原整個資料夾。重要提示:只有在您康復之前不要亂動它,這才會起作用!

如果它不起作用,請嘗試至少獲取數據並重新安裝系統。

相關內容