Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion pkg/block/block_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func diskWWN(paths *linuxpath.Paths, disk string) string {
// diskPartitions takes the name of a disk (note: *not* the path of the disk,
// but just the name. In other words, "sda", not "/dev/sda" and "nvme0n1" not
// "/dev/nvme0n1") and returns a slice of pointers to Partition structs
// representing the partitions in that disk
// representing the partitions in that disk. If a disk has no partitions,
// it returns information on the disk instead, but the Partition UUID is set
// to the empty string (since there isn't one.)
Comment thread
taigrr marked this conversation as resolved.
func diskPartitions(ctx *context.Context, paths *linuxpath.Paths, disk string) []*Partition {
out := make([]*Partition, 0)
path := filepath.Join(paths.SysBlock, disk)
Expand Down Expand Up @@ -222,6 +224,23 @@ func diskPartitions(ctx *context.Context, paths *linuxpath.Paths, disk string) [
}
out = append(out, p)
}
// this is a disk with no partitions on it.
// Consider the filesystem on the disk to be a partition.
Comment thread
taigrr marked this conversation as resolved.
if len(out) == 0 {
size := partitionSizeBytes(paths, disk, "")
mp, pt, ro := partitionInfo(paths, disk)
du := diskPartUUID(ctx, disk)
p := &Partition{
Name: disk,
SizeBytes: size,
MountPoint: mp,
Type: pt,
IsReadOnly: ro,
UUID: du,
}
out = append(out, p)

}
return out
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/snapshot/clonetree.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package snapshot

import (
"errors"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -149,7 +150,7 @@ func copyFileTreeInto(paths []string, destDir string, opts *CopyFileOptions) err
}
} else {
trace(" copying file: %q -> %q\n", path, destPath)
if err := copyPseudoFile(path, destPath); err != nil {
if err := copyPseudoFile(path, destPath); err != nil && !errors.Is(err, fs.ErrPermission) {
return err
}
}
Expand Down