|
@@ -76,6 +76,22 @@ func (m *Manager) DiskIsUsedInAnotherRAIDVol(sdXDev string) (bool, error) {
|
|
|
return false, nil
|
|
|
}
|
|
|
|
|
|
+// Check if the given disk (sdX) is root drive (the disk that install the OS, aka /)
|
|
|
+func (m *Manager) DiskIsRoot(sdXDev string) (bool, error) {
|
|
|
+ bdMeta, err := diskfs.GetBlockDeviceMeta(sdXDev)
|
|
|
+ if err != nil {
|
|
|
+ return false, err
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, partition := range bdMeta.Children {
|
|
|
+ if partition.Mountpoint == "/" {
|
|
|
+ //Root
|
|
|
+ return true, nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false, nil
|
|
|
+}
|
|
|
+
|
|
|
// ClearSuperblock clears the superblock of the specified disk so it can be used safely
|
|
|
func (m *Manager) ClearSuperblock(devicePath string) error {
|
|
|
isMounted, err := diskfs.DeviceIsMounted(devicePath)
|