mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
disable swap usage
This commit is contained in:
committed by
Aiden McClelland
parent
cd996826f3
commit
bb51512f52
@@ -129,10 +129,10 @@ pub async fn create_fs<P: AsRef<Path>>(
|
|||||||
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
||||||
.invoke(crate::ErrorKind::DiskManagement)
|
.invoke(crate::ErrorKind::DiskManagement)
|
||||||
.await?;
|
.await?;
|
||||||
Command::new("swapon")
|
// Command::new("swapon")
|
||||||
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
// .arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
||||||
.invoke(crate::ErrorKind::DiskManagement)
|
// .invoke(crate::ErrorKind::DiskManagement)
|
||||||
.await?;
|
// .await?;
|
||||||
} else {
|
} else {
|
||||||
Command::new("mkfs.ext4")
|
Command::new("mkfs.ext4")
|
||||||
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
||||||
@@ -178,10 +178,10 @@ pub async fn unmount_fs<P: AsRef<Path>>(
|
|||||||
swap: bool,
|
swap: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
if swap {
|
if swap {
|
||||||
Command::new("swapoff")
|
// Command::new("swapoff")
|
||||||
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
// .arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
||||||
.invoke(crate::ErrorKind::DiskManagement)
|
// .invoke(crate::ErrorKind::DiskManagement)
|
||||||
.await?;
|
// .await?;
|
||||||
} else {
|
} else {
|
||||||
unmount(datadir.as_ref().join(name)).await?;
|
unmount(datadir.as_ref().join(name)).await?;
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ pub async fn unmount_fs<P: AsRef<Path>>(
|
|||||||
#[instrument(skip(datadir))]
|
#[instrument(skip(datadir))]
|
||||||
pub async fn unmount_all_fs<P: AsRef<Path>>(guid: &str, datadir: P) -> Result<(), Error> {
|
pub async fn unmount_all_fs<P: AsRef<Path>>(guid: &str, datadir: P) -> Result<(), Error> {
|
||||||
unmount_fs(guid, &datadir, "main", false).await?;
|
unmount_fs(guid, &datadir, "main", false).await?;
|
||||||
// unmount_fs(guid, &datadir, "swap", true).await?;
|
unmount_fs(guid, &datadir, "swap", true).await?;
|
||||||
unmount_fs(guid, &datadir, "package-data", false).await?;
|
unmount_fs(guid, &datadir, "package-data", false).await?;
|
||||||
Command::new("dmsetup")
|
Command::new("dmsetup")
|
||||||
.arg("remove_all") // TODO: find a higher finesse way to do this for portability reasons
|
.arg("remove_all") // TODO: find a higher finesse way to do this for portability reasons
|
||||||
@@ -269,10 +269,10 @@ pub async fn mount_fs<P: AsRef<Path>>(
|
|||||||
.invoke(crate::ErrorKind::DiskManagement)
|
.invoke(crate::ErrorKind::DiskManagement)
|
||||||
.await?;
|
.await?;
|
||||||
if swap {
|
if swap {
|
||||||
Command::new("swapon")
|
// Command::new("swapon")
|
||||||
.arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
// .arg(Path::new("/dev/mapper").join(format!("{}_{}", guid, name)))
|
||||||
.invoke(crate::ErrorKind::DiskManagement)
|
// .invoke(crate::ErrorKind::DiskManagement)
|
||||||
.await?;
|
// .await?;
|
||||||
} else {
|
} else {
|
||||||
mount(
|
mount(
|
||||||
Path::new("/dev/mapper").join(format!("{}_{}", guid, name)),
|
Path::new("/dev/mapper").join(format!("{}_{}", guid, name)),
|
||||||
@@ -295,7 +295,7 @@ pub async fn mount_all_fs<P: AsRef<Path>>(
|
|||||||
password: &str,
|
password: &str,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
mount_fs(guid, &datadir, "main", false, password).await?;
|
mount_fs(guid, &datadir, "main", false, password).await?;
|
||||||
// mount_fs(guid, &datadir, "swap", true, password).await?;
|
mount_fs(guid, &datadir, "swap", true, password).await?;
|
||||||
mount_fs(guid, &datadir, "package-data", false, password).await?;
|
mount_fs(guid, &datadir, "package-data", false, password).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user