Extract VMDK file using power iso - linux

I was trying to extract a vmdk file using poweriso in linux mint by using the following command,
poweriso extract sample-disk1.vmdk / -od /home/local/test/VMDK/extracted/
But, I am getting the following error ,
PowerISO Copyright(C) 2004-2008 PowerISO Computing, Inc
Type poweriso -? for help
sample-disk1.vmdk: The file format is invalid or unsupported.
According to the documentation here power iso supports vmdk file,
Support all popular virtual disc image files, such as VMWare Virtual Disc Images(*.vmdk), VirtualBox Virtual Disc Images(*.vdi), Virtual PC Virtual Disc Images(*.vdi).
How can I extract a vmdk file using power iso?

I am providing information which I used to mount the qcow2 image and I hope the same will apply for vmdk too.
Installation of GuestFish
$> apt-get install libguestfs-tools
Mount qcow2 image
$> guestfish
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: 'help' for help on commands
'man' to read the manual
'quit' to quit the shell
><fs> add vAP.qcow2
><fs> run
><fs> list-filesystems
/dev/sda1: ext2
/dev/sda2: ext2
/dev/sda3: ext2
/dev/sda4: reiserfs
><fs> mount /dev/sda2 /
><fs> ls /
.ash_history
.rnd
.ssh
ash_env
bin
boot
bzImage
custom
defaults
dev
><fs> umount /
><fs> exit
You can make use of copy-in and copy-out to copy files from vmdk to host and vice versa

Related

Flashing to SD Yocto image following solidrun tutorial

I'm following these steps (https://github.com/SolidRun/meta-solidrun-arm-imx8) to build a Yocto image. I have built one, but on the last step, it doesn't work.
bunzip2 -c tmp/deploy/images/imx8mpsolidrun/core-image-minimal-imx8mpsolidrun.wic.bz2 | sudo dd of=/mnt/F bs=1M
dd: failed to open '/mnt/F': Is a directory
My SD is mounted on F and I'm using Ubuntu 18.04 WSL. What is wrong? I have tried to decompress the file imx8mpsolidrun/core-image-minimal-imx8mpsolidrun.wic.bz2
but i get this:
bzip2: Input file tmp/deploy/images/imx8mpsolidrun/core-image-minimal-imx8mpsolidrun.wic.bz2 is not a normal file.
What is wrong here?
Thank you so much.
Well you are not following the tutorial.
dd command allow you to write in a file not a directory, "of" stands for output file https://man7.org/linux/man-pages/man1/dd.1.html. Here you try to do it on a directory.
When you plug your usb device, a new file is created at /dev/. It is often /dev/sdX with X a letter. For instance /dev/sda or /dev/sda1.
Hence I suggest you to determine what is the file created when you plug your device.
# usb not mounted
sudo blkid
# usb mounted
sudo blkid
Then you will find your /dev/sdX. Afterwards type your command as suggested in the tutorial :
bunzip2 -c tmp/deploy/images/imx8mpsolidrun/imx-image-full-imx8mpsolidrun.wic.bz2 | sudo dd of=/dev/sdX bs=1M

Increasing Amazon Linux 2 AMI /tmp size

I'm trying to install tensorflow on a Amazon linux AMI EC2 micro instance, but I keep getting EnvironmentError: [Errno 28] No space left on device even while the disk is empty.
On ubuntu server, I fix this increasing the /tmp size with the command sudo mount -o remount,size=4G,noatime /tmp, however this command fails on Amazon Linux telling me that /tmp is not mounted at all.
How can I increase /tmp size on Amazon Linux 2?
Thx!
Following can help in achieving the tmp space.
cd # change to your home directory
fallocate -l 20G mydrive.img # create the virtual drive file
mkfs -t ext3 mydrive.img # format the virtual drive
sudo umount /tmp # unmount the /tmp
sudo mount -t auto -o loop mydrive.img /tmp # mount the virtual drive

Vagrant unable to mount in Linux guest with VirtualBox Guest Additions on Windows 7

I'm trying to get a Linux VM using Virtual Box, Virtual Box Guest Additions, and Vagrant running and to mount a folder on my Windows 7 machine. I've tried the suggestions in this question, but still get the same error.
I'm running the following versions:
Virtual Box: 4.3.18 r96516
Virtual Box Guest Additions: 4.3.18
Vagrant: 1.6.5
Vagrant Plug-ins:
vagrant-login: 1.0.1
vagrant-share: 1.1.2
vagrant-vbguest: 0.10.0
When I run vagrant reload I get the following error:
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,
nolock,vers=3,udp,noatime core /tbm
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,nolock,vers=3,udp,noa
time core /tbm
The error output from the last command was:
stdin: is not a tty
unknown mount option `noatime'
valid options:
rw mount read write (default)
ro mount read only
uid =<arg> default file owner user id
gid =<arg> default file owner group id
ttl =<arg> time to live for dentry
iocharset =<arg> i/o charset (default utf8)
convertcp =<arg> convert share name from given charset to utf8
dmode =<arg> mode of all directories
fmode =<arg> mode of all regular files
umask =<arg> umask of directories and regular files
dmask =<arg> umask of directories
fmask =<arg> umask of regular files
I've tried un-installing, installing, updating the vagrant-vbguest plugin:
vagrant plugin install vagrant-vbguest
I've tried running the following command after running vagrant ssh, but still get the same error message:
sudo ln -s /opt/VBoxGuestAdditions-4.3.18/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
I'm not super familiar with mount options, but I tried executing your command in a similar VM I'm running and got the same error regarding the noatime option.
I read through the documentation (man 8 mount) which states somewhere after line 300 or so, in the FILESYSTEM INDEPENDENT MOUNT OPTIONS that: Some of these options are only useful when they appear in the /etc/fstab file.
I suspect this is your problem. I edited my /ect/fstab file to change one of my mounts to /dev/mapper/precise64-root / ext4 noatime,errors=remount-ro 0 1 this option and then ran the following:
sudo mount -oremount /
vagrant#precise64:~$ mount
/dev/mapper/precise64-root on / type ext4 (rw,noatime,errors=remount-ro)
...
I edited the file again to remove the option and:
vagrant#precise64:~$ sudo mount -oremount /
vagrant#precise64:~$ mount
/dev/mapper/precise64-root on / type ext4 (rw,errors=remount-ro)
...
I don't know if you're providing these mount commands or if they come from a plugin, but it seems like (at least in your environment), the option works fine, but can't be specified on the command line.

How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

I want to modify linux kernel so that it can mount vhd files and starts from it...please give me some idea!!! As we know that linux kernel mount hardisk partitions after the initrd.gz is loaded...i want that instead of mounting the linux partiton it should mount a vhd file located some where in the harddisk which containes ubuntu installed and start the system from it. Windows 7 support this feature of booting from vhd but ubuntu does not..so that y i was asking that how we can modify the kernel for this purpose. Thank You
This will not be easy at all.
To start loading Linux a bootloader is used. This program locates the vmlinux or vmlinuz file and the initrd file and loads them into RAM.
I assume your VHD file is stored on a NTFS filesystem. Inside the VHD file are the vmlinuz and initrd files.
So first, the bootloader will need to understand NTFS. Next, the bootloader will need to understand VHD.
Only after that can Linux even begin to load.
At that point, things become easier because Linux has NTFS filesystem drivers that you can use. Probably the NTFS-3G user-space driver combined with FUSE. I am not sure of the VHD formats but you could use vdfuse from VirtualBox to mount it.
The NTFS and VHD mount programs would have to go inside the initrd. Then the initrd can mount the root partition from the VHD and proceed into normal Linux user-space.
If you are trying to boot Ubuntu Linux, here is what I did:
Download vboot-v1 install in windows, or google for grub2 solution
Install Virtualbox
Install Ubuntu with Virtualbox, choose vhd type of disk
Install virtualbox-fuse in Ubuntu
In ubuntu, add this files to filesystem:
/etc/initramfs-tools/hooks/vdfuse
#!/bin/sh
set -e
PREREQ=""
prereqs()
{
echo "${PREREQ}"
}
case "${1}" in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
if [ -x /usr/ ]
then
copy_exec /usr/bin/vdfuse /bin
fi
/etc/initramfs-tools/sc~ts/init-bottom/vhdhost
#!/bin/sh
PREREQ=""
# Output pre-requisites
prereqs()
{
echo "$PREREQ"
}
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
mount -n -o move /vhdhost ${rootmnt}/vhdhost
exit 0
/etc/initramfs-tools/scripts/init-top/vdfuse
#!/bin/sh
PREREQS=""
prereqs()
{
echo $PREREQS
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
mkdir /vhdhost
mount /dev/sda2 /vhdhost/ -t ntfs-3g
mkdir /dev/vhdhost
vdfuse -f /vhdhost/$vloop /dev/vhdhost
exit 0
run update-initramfs -k all -c
Now, you just have to modify bootloader to load your vhd file, for example, add this to grub.cfg:
menuentry "VHD Ubuntu 12.10 64-bit" {
insmod vhd
vhd vhd0 (hd0,2)/vhd/Ubuntu.vhd --partitions
linux (vhd0,1)/boot/vmlinuz-3.5.0-23-generic root=/dev/vhdhost/Partition1 vloop=/vhd/Ubuntu.vhd quiet splash
initrd (vhd0,1)/boot/initrd.img-3.5.0-23-generic
}

KVM Virtual machine running Windows XP: How to get files from guest to host?

I'm running Ubuntu 10.04, and on it, kvm/qemu. I created a storage device with the 'raw' format and installed XP on it, so I assume the file has ntfs format. I have a file on the XP virtual machine that I want on the host. It's 2gigs, so I can't just use a zip drive or burn it to CD.
I tried mounting the file (winxp.img) using losetup:
$ sudo losetup /dev/loop1 winxp.img
$ sudo losetup -a
/dev/loop1: [0801]:40637460 (/home/robert/kvm/images/winxp.img)
$ sudo mount -t ntfs /dev/loop1 /home/robert/kvm/images/tmp
NTFS signature is missing.
Failed to mount '/dev/loop1': Invalid argument
The device '/dev/loop1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
I thought that would work. It didn't. Does anyone have another idea?
winxp.img and loop1 is not a single partition (which can be mounted), it is image of full hard disk with own partition table.
You should read partition table from loop1 with fdisk; compute offset of first partition and do:
sudo mount -o offset=N -t ntfs /dev/loop1 /home/robert/kvm/images/tmp
where N is offset in bytes.
Telepathic mode on
N is 32256
Telepathic mode off
and finally, google mode on (I'll google "offset 32256"):
http://en.wikibooks.org/wiki/QEMU/Images#Mounting_an_image_on_the_host
Linux and other Unix-like hosts can mount images created with the raw format type using a loopback device. From a root login (or using sudo), mount a loopback with an offset of 32,256.
mount -o loop,offset=32256 /path/to/image.img /mnt/mountpoint
In my opinion the generic and correct way is via libguestfs http://libguestfs.org/
If you master it, you can open every virtual image in any format and get files or even make snapshots

Resources