mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
fix: probe active block device before vg import cycle
When the target VG is already active (e.g. the running system's own VG), probe the block device directly instead of going through the full import/activate/open/cleanup sequence.
This commit is contained in:
@@ -409,6 +409,18 @@ pub async fn mount_all_fs<P: AsRef<Path>>(
|
||||
/// filesystem type. Returns `None` if probing fails (e.g. LV doesn't exist).
|
||||
#[instrument(skip_all)]
|
||||
pub async fn probe_package_data_fs(guid: &str) -> Result<Option<String>, Error> {
|
||||
// If the target block device is already accessible (e.g. this is the
|
||||
// currently active system VG), probe it directly without any
|
||||
// import/activate/open/cleanup steps.
|
||||
let blockdev_path = if !guid.ends_with("_UNENC") {
|
||||
PathBuf::from(format!("/dev/mapper/{guid}_package-data"))
|
||||
} else {
|
||||
Path::new("/dev").join(guid).join("package-data")
|
||||
};
|
||||
if tokio::fs::metadata(&blockdev_path).await.is_ok() {
|
||||
return detect_filesystem(&blockdev_path).await.map(Some);
|
||||
}
|
||||
|
||||
// Import and activate the VG
|
||||
match Command::new("vgimport")
|
||||
.arg(guid)
|
||||
|
||||
Reference in New Issue
Block a user