Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way that I can use my Linux ext4 file system, as such and then use it on some other computer.

I have a dual-boot of Windows 7 and Ubuntu 10.04 and my partition table looks like this:

My partition table

My question might not be clear, so explaining it with an example.

Can I copy my Linux partition on a flash drive and then use it on a different PC, with or without any need to install Ubuntu on new PC, by simply booting from the copied ext4 partition.
This way, I can easily port my Ubuntu packages and other applications, settings etc. from one PC to other.

If it's a very stupid question, please don't mind.

share|improve this question
    
...why did you post the table as a picture? –  grawity Mar 18 '11 at 16:22

1 Answer 1

up vote 1 down vote accepted
  1. The simplest way is to create an empty partition of exactly the same size1, then dd over the data.

    dd if=<inputfile> of=<outputfile>
    

    For example, if you were to copy from /dev/sda3 to /dev/sdc1, you would use dd if=/dev/sda3 of=/dev/sdc1.

    (You can copy into a regular file too, but it wouldn't be easily bootable, although you can loop-mount such a copy in an already-running system.)

  2. To make the copy bootable, you will need to install a bootloader into the flash drive.

    grub would work, but I'm not sure if the latest version supports specifying the root partition by UUID. (It used to be an Ubuntu-specific patch.) UUIDs are needed because grub needs a filesystem identifier that stays the same among computers.


1 The partition and the filesystem store their sizes independently; therefore, the partition must be as big as the filesystem thinks it is. You can create a larger partition and later grow the copied filesystem, though. Most filesystems can be shrunk too.

share|improve this answer
    
Thanks. However, making the copy bootable and how the partition and filesystem store their sizes independently, is quite unclear. Can you guide me through a tutorial or an article which explains this. –  Jatin Ganhotra Mar 19 '11 at 4:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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