Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is crazy I know, My recent experiment gave me a unforgettable experience, I usually use ubuntu as a Wubi installation because it is easy to backup my 10.10 system and give a try to new versions without any problems.

So after i booted to ubuntu 10.10 I can rename, move or even delete my root file in /Host/ubuntu/disks directory,Then I used to boot my 11.10 system directly by renaming current 10.10 root file and copying 11.10 root file to the same directory,

How is that possible, does ubuntu run completely on Ram? or is there a cached root file elsewhere? I'm confused,

I think I can even remove my hard disk when ubuntu is running (If swap disk not included in the same disk) but in the windows, it is a dream!!!, how is this possible?

share|improve this question
    
Are you talking about moving the file around from within Ubuntu, or while you are booted in Windows? –  James Henstridge Mar 16 '12 at 2:57
    
Within ubuntu!!!, It's unbelievable, I switch between 10.10 and11.10 using this method!!!, It's fast. no need to boot windows and copy root files. I Think it's a bug, Because Ubuntu locks the swap file but not the root file. –  Prasad RD Mar 16 '12 at 3:53

1 Answer 1

up vote 1 down vote accepted

A Wubi install makes use of loopback mounts. Essentially it mounts your Windows file system, and then treats a file within that file system (your root file) as a block device. This basically means that rather than reading the blocks of the file system from a partition directly, it looks at the layout of the file in the other file system to locate each individual block. It isn't running the system out of RAM.

It then performs some gymnastics to make the loopback mounted file system appear as the root, and your Windows file system appear somewhere below the root.

As a general rule, you should not modify the backing file for a loopback mount, since it can confuse the file system driver that is referring to that file. It would seem the actions you took were not enough to cause these problems though.

On UNIX systems, once you open a file for access it is still possible to read it without causing problems. Consider the following short Python example:

import os

with open('oldname', 'w') as fp:
    fp.write('content')
with open('oldname', 'r') as fp:
    os.rename('oldname', 'newname')
    print(fp.read())

As with your loopback mounted file system, we can still read the content after moving the file. We can see a similar effect when removing a file:

with open('newname', 'r') as fp:
    os.remove('newname')
    print(fp.read())

While the file name is removed, the actual content sticks around until the last open file descriptor is closed. The loopback mount can be thought of as a file descriptor for these purposes.

Copying the file is also unlikely to confuse the loopback mount (since it is just reading the original), but is not necessarily a good way to perform a backup. It takes a while to read through a large file, so by the time you've got to the end of the file the start might have been modified. So if you try to use the copied file as a disk image, it may appear to be corrupted (although that corruption may be fixable with a file system check).

If you want to back up your system, I would suggest either using the backup tool included with Ubuntu, or booting to Windows and copying the disk image there (since Ubuntu is not running, there is no chance of the disk image changing while you're copying it).

share|improve this answer
    
Thanks, I never had a gigantic answer like this!!!, Ok as you said it is using the root file whatever I do (Except delete), So it is safe to rename 10.10 root file and copy 11.10 root file and reboot to 11.10, isn't it? –  Prasad RD Mar 16 '12 at 5:33

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.