Skip to content

Instantly share code, notes, and snippets.

View Joyfolk's full-sized avatar

Mikhail Turnovskiy Joyfolk

View GitHub Profile
@Joyfolk
Joyfolk / ssd.scala
Created July 28, 2022 07:00
How to find linux device name for path and check if it is ssd
import java.io.File
import java.nio.file.{Files, Path}
import scala.io.Source
def deviceName(path: Path): String = {
val absPath = path.toAbsolutePath
val fsName = Files.getFileStore(absPath).name()
val fsPath = absPath.getRoot.resolve(fsName).toRealPath()
fsPath.getFileName.toString