MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / mount_e2fs

Method mount_e2fs

dstack-util/src/system_setup.rs:1192–1228  ·  view source on GitHub ↗
(dev: &impl AsRef<Path>, mount_point: &impl AsRef<Path>)

Source from the content-addressed store, hash-verified

1190 }
1191
1192 fn mount_e2fs(dev: &impl AsRef<Path>, mount_point: &impl AsRef<Path>) -> Result<()> {
1193 let dev = dev.as_ref();
1194 let mount_point = mount_point.as_ref();
1195 info!("Checking filesystem");
1196
1197 let e2fsck_status = Command::new("e2fsck")
1198 .arg("-f")
1199 .arg("-p")
1200 .arg(dev)
1201 .status()
1202 .with_context(|| format!("Failed to run e2fsck on {}", dev.display()))?;
1203
1204 match e2fsck_status.code() {
1205 Some(0 | 1) => {}
1206 Some(code) => {
1207 bail!(
1208 "e2fsck exited with status {code} while checking {}",
1209 dev.display()
1210 );
1211 }
1212 None => {
1213 bail!(
1214 "e2fsck terminated by signal while checking {}",
1215 dev.display()
1216 );
1217 }
1218 }
1219
1220 cmd! {
1221 info "Trying to resize filesystem if needed";
1222 resize2fs $dev;
1223 info "Mounting filesystem";
1224 mount $dev $mount_point;
1225 }
1226 .context("Failed to prepare ext4 filesystem")?;
1227 Ok(())
1228 }
1229
1230 fn luks_setup(&self, disk_crypt_key: &str, name: &str) -> Result<()> {
1231 let root_hd = &self.args.device;

Callers

nothing calls this directly

Calls 2

as_refMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected