mirror of
https://github.com/linka-cloud/d2vm.git
synced 2024-11-22 07:46:25 +00:00
use kpartx instead of partprobe (close #19)
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
8659907d62
commit
618b5bc861
@ -33,6 +33,7 @@ RUN apt-get update && \
|
||||
util-linux \
|
||||
udev \
|
||||
parted \
|
||||
kpartx \
|
||||
e2fsprogs \
|
||||
mount \
|
||||
tar \
|
||||
|
@ -265,10 +265,10 @@ func (b *builder) mountImg(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
b.loDevice = strings.TrimSuffix(o, "\n")
|
||||
if err := exec.Run(ctx, "partprobe", b.loDevice); err != nil {
|
||||
if err := exec.Run(ctx, "kpartx", "-a", b.loDevice); err != nil {
|
||||
return err
|
||||
}
|
||||
b.loPart = fmt.Sprintf("%sp1", b.loDevice)
|
||||
b.loPart = fmt.Sprintf("/dev/mapper/%sp1", filepath.Base(b.loDevice))
|
||||
logrus.Infof("creating raw image file system")
|
||||
if err := exec.Run(ctx, "mkfs.ext4", b.loPart); err != nil {
|
||||
return err
|
||||
@ -285,6 +285,9 @@ func (b *builder) unmountImg(ctx context.Context) error {
|
||||
if err := exec.Run(ctx, "umount", b.mntPoint); err != nil {
|
||||
merr = multierr.Append(merr, err)
|
||||
}
|
||||
if err := exec.Run(ctx, "kpartx", "-d", b.loDevice); err != nil {
|
||||
merr = multierr.Append(merr, err)
|
||||
}
|
||||
if err := exec.Run(ctx, "losetup", "-d", b.loDevice); err != nil {
|
||||
merr = multierr.Append(merr, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user