Ubuntu

如何掛載 LVM 分區?

  • September 8, 2021

我試圖更新 Java,我用一顆星來確保它被完全刪除,沒有意識到它會搞砸一切

我用了

apt-get remove java*

這是在 Ubuntu 16.0 或其他伺服器上。我現在在伺服器上有 sysrcd 或 System Rescue CD,我正在嘗試取回舊文件以將它們放在新伺服器上並將 sysrcd 伺服器重新載入回 Ubuntu。但是我似乎無法弄清楚如何使用安裝系統。

我試過跑步

fdisk -l

我得到

Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04a5ca62

Device    Boot     Start       End    Blocks  Id System
/dev/sda1 *         2048      4095      1024  83 Linux
/dev/sda2           6142 468860927 234427393   5 Extended
/dev/sda5           6144   2004991    999424  83 Linux
/dev/sda6        2007040 468860927 233426944  8e Linux LVM


Disk /dev/mapper/vg-root: 221.6 GiB, 237879951360 bytes, 464609280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/vg-tmp: 976 MiB, 1023410176 bytes, 1998848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/vg-swap: 88 MiB, 92274688 bytes, 180224 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

我不確定要安裝哪個驅動器或如何安裝它。有人可以幫忙嗎?

LVM掛載分區與非 LVM 分區時,還需要幾個步驟。

sudo apt-get install lvm2   #This step may or may not be required.
sudo pvscan                 #Use this to verify your LVM partition(s) is/are detected.
sudo vgscan                 #Scans for LVM Volume Group(s)
sudo vgchange -ay           #Activates LVM Volume Group(s)
sudo lvscan                 #Scans for available Logical Volumes
sudo mount /dev/YourVolGroup00/YourLogVol00 /YourMountPoint

還有使用gnome-disks 的gui 方法

  • 選擇磁碟和分區
  • 點擊帶有齒輪圖示的“更多操作”按鈕
  • 打開:“編輯安裝選項”菜單項
  • 關閉使用者預設值,因為
  • 複選框“系統啟動時掛載”

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