0

I am trying to build linux from scratch. I ll install it into virtualbox. Later I want to extract ext2 filesystem in it. Is it possible?

EDIT: I want to extract root.ext2 filesystem in vdi, to mount it in Ubuntu desktop environment and chroot into it.

EDIT2: moderators marked my topic as duplicate but it's not duplicate of above mentioned topic at all.

I found complete answer of my question. I post the link as a reference to people who seek the same answer: http://www.turnkeylinux.org/blog/convert-vm-iso

kenn
  • 5,162
  • Yes but this is not related to a problem with Ubuntu. – Rinzwind Apr 15 '14 at 07:54
  • @Rinzwind I used vdi tag. It's not Ubuntu specific question. – kenn Apr 15 '14 at 08:07
  • @SylvainPineau I checked out that link and similar links, they don't mention how to extract root.ext2 filesystem, they only mention how to view filesystems – kenn Apr 15 '14 at 08:09

2 Answers2

0

I have not tried it, but these could be the steps:

  1. map a host folder as shared folder in virtual box machine.
  2. use dd command from within the vm to raw copy the vm disk to a file in the shared folder.
  3. use the raw file and dd to write it to a real hardisk.
  4. use something like gparted to strech the partition to the harddisk length, if not same size.
  5. boot for that partition and see it if works.
ppp
  • 16
  • Thank you for answer. It might work but I want to know how to extract ext2 root filesystem into desktop as in lfs live iso image. – kenn Apr 15 '14 at 08:23
0

If your VDI is of type static then you can use a loop mount to mount the VDI in your host using ntfs-3g and just accesses it like any other file system.

If it is a dynamic VDI then you can create a temporary VM using a liveCD. Then temporarily release your VDI from your XP VM and assign it to this VM. When you boot the live CD you can then open a command shell and do

    sudo -i
mkidir /xp
mount -t ntfs3g /dev/hda1 /xp
cd /xp
#You can now access and edit the XP VDI

If you want to move files to and from the host, there are various ways: e.g. a second static VDI which you can then loop mount on your host; good old ftp ...

Simplew
  • 806
  • Thank you for answer. I ll try your approach but I think you got me wrong, it's not a XP virtual machine. I am on Ubuntu 13.10 platform, and I ll create a VM and create ext2 filesystem to install LFS (linux from scratch) in it then I ll extract root.ext2 filesystem into desktop (if posssible) and mount it in Ubuntu and chroot into it. – kenn Apr 15 '14 at 09:40