Saturday, November 15, 2008

make space for linux in dual boot without repartitioning

NOTE: if you read the tutorial and are still experiencing difficulties and would like help, you are asked to start a new topic on the forums.
Please do NOT reply to this thread to ask a technical question. Replies to THIS thread should be corrections and enhancements on the tutorial/howto only.
Thanks in advance for your co-operation.
LinuxForums.org

------------------------------------------

Note: I am not a linux expert. So verify these steps.

If you have a dual boot system with windows and your linux partition is falling

short of space this article will help you grab windows partition disk space to

linux (grabbed space will have ext2 filesystem !) WITHOUT REPARTITIONING

I have fedora core 1 and win98 dual boot. LINUX 3.5 GB, WINDOWS 35 gb. Soon my linux

space was insufficient.

Mounting a windows fat32 partition /dev/hdax (/dev/hda1 is your c in /mnt/y using

mount -t msdos /dev/hdax /mnt/y

won't be any good as the files in it does not support long file names .To test : make text files

yourname1 and yourname2 in your ext2/ext3 partiton ie /root or any directory were dos

partitions are not mounted. Now try copying the above files one after the other into /mnt/y

were dos drive is mounted. It will ask for overwriting conformations !!!. That means whenever

you want to use such mounted drives, some files, like above two, cannot be saved in same

directory !!!.

So this is what you have to do : use a loop filesystem.

A loop filesystem is one created in a file in a partiton with any other/same file system.
So you will be creating a file in your mounted dos partiton, make ext2 filesystem in that
file, mount that file as a 'partiton' and use the space in that file to save your linux data.
Thus you are using your dos space but still having ext2 filesystem. None of the above
problems of filename exists here, but it might be a bit slow.

Lets start (i assume you are root):

1. mount your dos partiton (preferably avoid c drive) /dev/hdax in existing path /mnt/y by

mount -t msdos /dev/hdax /mnt/y

2. make a file fedora.img of say 100 mb which acts as loop filesystem

dd if=/dev/zero of=/mnt/y/fedora.img bs=1024 count=102400

'bs' is blocksize. To make 'A' MB filesystem get count value as Ax1024=B formula

3. make ext2 filesystem in that file

mkfs -t ext2 /mnt/y/fedora.img

Press y when asked. This will successfully create the loop filesystem.

4. WARNING: Now we will mount this filesystem only in a newly created directory. Do not

mount in existing paths like /usr or /root etc !

Do 'mkdir /root/test'. Add lines

/dev/hdax /mnt/y msdos defaults

/mnt/y/fedora.img /root/test ext2 loop 0 0

to your /etc/fstab file (please back it up first). The first line is to mount ur /de/hdax.

5. Restart linux or use 'disk management' tool to mount the loop filesystem in /root/test.

( /dev/hdax should be mounted first )

6. Now the folder /root/test uses windows partition and not your linux space. Use it to

save files/folders which were occupying large space in linux. I will give you my example:


i had the source of kernel 2.6.7 in /usr/src path in directory linux-2.6.7 occupying 315 MB. So

i copyed the contents of /usr/src/linux-2.6.7/ to /root/test/ (ofcourse my loop was bigger than

created above. It was of 350 Mb). I did not copy linux-2.6.7 directory itself, only whatever is

inside it to /root/test/ Remember to enable view of hidden files and copy them also to /root/test/

Now I deleted the directory /usr/src/linux-2.6.7/ contents (keep the directory linux-2.6.7,

remove its contents only) (remember to backup till you are confident with this method)

Thus i freed my linux space !!!

Then i unmounted the loop filesystem in /root/test by
editing my /etc/fstab to remove line

/mnt/y/fedora.img /root/test ext2 loop 0 0

and adding

/mnt/y/fedora.img /usr/src/linux-2.6.7 ext2 loop 0 0

and restarting my comp.

7: Use 'df' to view the results. I again had my /usr/src/linux-2.6.7/ but now it was using loop

filesystem present in windows partiton.

8. If you want to shift a file/folder to loop filesystem, then create around 20 mb bigger

filesystem than your file/folder. Otherwise you might get disk full errors. I don't know why ?

And thats all. I was able to free around 700 MB of linux space and grab windows space

without repartitioning anything. U can use the mounted loop filesystem in many other ways.

1 comment:

Blogger said...

Do you understand there's a 12 word phrase you can tell your man... that will trigger deep feelings of love and impulsive appeal to you buried inside his chest?

Because deep inside these 12 words is a "secret signal" that triggers a man's instinct to love, cherish and guard you with his entire heart...

12 Words That Fuel A Man's Love Instinct

This instinct is so hardwired into a man's genetics that it will make him work better than before to to be the best lover he can be.

Matter of fact, fueling this mighty instinct is so essential to achieving the best possible relationship with your man that once you send your man one of these "Secret Signals"...

...You'll immediately find him open his heart and soul to you in a way he haven't experienced before and he will distinguish you as the only woman in the galaxy who has ever truly understood him.