npm.io
2.1.3 • Published 2 months agoCLI

@vates/fuse-vhd

Licence
ISC
Version
2.1.3
Deps
6
Size
9 kB
Vulns
0
Weekly
0
Stars
985

@vates/fuse-vhd

Package Version License PackagePhobia Node compatibility

Install

Installation of the npm package:

npm install --save @vates/fuse-vhd

Usage

Mount a vhd generated by xen-orchestra to filesystem

Library
import { mount } from 'fuse-vhd'

// return a disposable, see promise-toolbox/Disposable
// unmount automatically when disposable is disposed
// in case of differencing VHD, it mounts the full chain
await mount(handler, diskId, mountPoint)
cli

From the install folder:

cli.mjs <remoteUrl> <vhdPathInRemote> <mountPoint>

After installing the package

xo-fuse-vhd <remoteUrl> <vhdPathInRemote> <mountPoint>

The remoteUrl can be found using the following command from the XOA CLI, and then picking the right url property:

xo-server-db ls remote

The vhdPathInRemote follows a file structure described in VM backups.

Restore a file from a VHD using fuse-vhd CLI

  1. Mount a VHD to the Filesystem (see Usage).
  2. Verify the VHD is Correctly Mounted:

mount | grep fuse

  1. Get the START and SIZE of the disk whose file you want to restore. Multiply START by 512 (block size) to get the offset value. (mountedVhdPath is the mountPoint value from earlier, followed by /vhd0, for example). Depending on the partition type, you may need to do some additional setup to discover the partitions.

partx --bytes --output=NR,START,SIZE,NAME,UUID,TYPE --pairs <mountedVhdPath>

  1. Mount the disk. Depending on the partition type, you may need to add some additional options. The norecovery option is used for ext3/ext4/xfs file systems; otherwise, remove this option.

mount --options=loop,ro,norecovery,sizelimit=<SIZE>,offset=<START*512> --source=<mountedVhdPath> --target=<diskMountPoint>

  1. Copy your files from the mounted partition, then unmount the partition.

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC Vates SAS