We folder called vz which contains a logical file structure of a linux system. We then need to boot that system.

Is this possible?

For example, inside the vz folder we have `bin boot dev etc home' folders. Can we copy that over to a hard drive (with either dd or just a logical copy) and then boot that machine?


Are you sure you need to "boot" off of this directory? (Where would your boot loader come from, etc)

Have you considered using the chroot command? You can use it to run a "command" shell (like bash) that treats your directory as the root of it's file system.

Other things to look into include Linux Containers (LXC) and Docker.


In theory you can copy this over to a hard drive and boot off it, but with a few caviats/tweeks.

First off, you can't use dd as this copies block devices, you need to prepare the new system and use something like cp -var or rsync - Now to answer the meat of the problem The new hard drive needs to be (a) partitioned in such a way that the description of it is compatible with the filesystem - which in practice probably means matching the contents of fstab, and possibly having the appropriate partition set to bootable.
(b) Needs to formatted in a way that the "initial" Linux system can read - so probably ext4. (c) Needs to have an appropriate loader installed on the drive - this typically means installing grub onto the new hard drive. (d) you do not want empty directories for /proc /sys /dev as these are special folders generated by the OS.

There may be other minor gotchas.

Depending on what you are attempting, you might want to instead create a VM with a block device, then do an OS install - using the variant of Linux which is most similar to the one you are trying to create. Then copy /etc to a backup location and mirror the appropriate paths in the vz image. You might need to revisit and tweek files like /etc/fstab (hence why you want a backup of /etc). You also need to be careful of the kernel image - if this is different you will need to tweek grub.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.