Академический Документы
Профессиональный Документы
Культура Документы
235
PAGES
TOP CONTENT
EDIT
RECENT BLOG POSTS
ExpandingRoot SHARE
EXPLORE
Contents [show]
Since you use your Host Operating System (Windows XP) to perform the Linux
commands and copy files, this method is faster than performing the same steps
under coLinux.
This way seems more complicated, but it is faster and safer. A backup is inclusive by doing it this way. Packages and Tools
A FANDOM user • November 21, 2017
You will need the same free disk space as compared to a backup, increase filesize, and resize the
new image. One advantage, you need less free disk space because you can create the new image as
a sparse file.
This method is extremely dangerous and can damage an existing image. At first, it seems faster, but,
we strongly recommend you make a backup, so it ends up not being faster as the first method. If you
don't create a backup, then it is faster, and needs less free disk space as the method above. In some
cases you have limits on the filesystem and the proces will fail.
This does not make the root filesystem bigger, but it adds more space at a mount point in the
filesystem and gives the root filesystem some free space. For example, if you move the /home, /usr
or /opt into additional image file. This is a good idea if you are creating your system. Or later, if you
feel your /home directory needs more space and the system can use the another 2 to 4GB. Splitting
/home and the rest make an upgrade or system change easier.
The differences between the methods are: some need the complete Cygwin shell, others use only a
subset of commands (e.g. fs2resize.exe) and others use only Windows tools and do the rest in Linux.
1 GB = 1073741824
2 GB = 2147483648
4 GB = 4294967296
5 GB = 5368709120
8 GB = 8589934592
x GB = x*1024^3
2) Edit the colinux configuration file to add the blank file as a new device,
cobd1="c:\New.img"
5) Create a mount point and mount the new filesystem from the cobd device:
mkdir /tmp/mnt
mount /dev/cobd1 /tmp/mnt (that's /dev/cobd/3 on GenToo)
7) Copy device nodes (only if you have a udev system, i.e. kernel 2.6+). if [ -d /dev/.udev ]; then
cp -a /dev/* /tmp/mnt/dev/; fi
8) Ensure the file /tmp/mnt/etc/fstab does not have 'labels'. Use only /dev/cobd... there.
12) From windows, edit your config file again. Change the entry of the old device to use the newly created
file. Then remove the entry created above.
13) Restart coLinux. You should have a larger filesystem (use "df -h" to check).
Keep the old file until you're sure the new one works!
This tool will increase the file size, resize the file system and check the file system integrity. The programs
behind this tool are Linux file systems tools ported to Cygwin. TopoResize is also a good source for
getting cygwin ports of e2fsprogs. It is just a tcl/tk front end for them, so advanced users can use them at
the command line.
Before you start this tool, be sure you are not running other Cygwin shells. You can run only one
Cygwin.dll at a time!
TopoResize can now be found at Chris Semler (the author's webpage) or from one of the following
mirrors:
http://csemler.com/toporesize-0.7.1.zip
http://www.henrynestler.com/colinux/tools/toporesize-0.7.1.zip
The fastest way to enlarge the root partition (live) Edit
Using dd Edit
WARNING: Data loss possible! This method has a limit on how much bigger the resulting image can be,
see here .
Calculate size of root image in 16K blocks: Assuming root image size is 1 gigabyte / 16384 = 65472
blocks
Enlarge root image: (seek= argument specifies old image size, in blocks, count= specifies how much to
add, in blocks)
On Ubuntu, you'll need to download the deb file first, as it's no longer in the repository: (ext2online installs
in /usr/sbin, so you'll only see this as root)
wget http://ubuntuarchive.hnsdc.com/ubuntu/pool/universe/e/ext2resize/ext2resize_1.1.19-9_i386.deb
dpkg -i ext2resize_1.1.19-9_i386.deb
ext2online /dev/cobd0
Done!
Alternatively, you can use resize2fs, which is part of e2fsprogs. This may be preferable on an Ubuntu
system as it is still in the repository.
Done.
As an alternate to dd, you can use toporesize (from within windows) (see
http://www.andlinux.org/forum/viewtopic.php?t=131 ).
I started with a 1GB partition and tried to resize it with topresize. Despite making the size around 10GB,
the resulting file only had another 1GB available and using topresize to change the file a second time
resulted in a kernel panic when it tried to mount the resulting file system.
I used toprestore to create an empty 32GB file without any problems and mounted it on a second mount
point, but I always want my filesystem inside a single file to make it simpler to back up.
Requirements Edit
In the last 36 years, I have told users "If you reach the point where you wouldn't want to do it all again,
you should have already backed it up." Do they listen? Guess.
The simplest option is to create a folder and copy your original image file into it and then create a config
file that points to the file in the new location.
Method Edit
In the following:
The size is in bytes (thanks MS) but you can always copy it out of Windoze calculator. A power of two is a
very good plan, so multiply your required size by 1,024 * 1,024 for megs and by another 1,024 for gigs.
Open a command window, navigate to the folder that you want to use, then type:
This creates a sparse file of the required size. Never copy this file or it will magically shrink from umpteen
gigs to a couple of K! Instead, type:
Note the /b option specifying binary format for both files - omitting this will make the copy very fast and the
output file very small.
{new} should now contain an image file of the original size with {size} bytes free on the pseudo partition.
Start up CoLinux using the alternative config file that specifies {new} and log in as root.
resize2fs /dev/cobd0
This will expand the image file to the maximum extent available in {new}.
All that remains is to delete bigfile and move the new file over to your preferred folder.
Enjoy :D
First, look at the very bottom of this page. There is a fairly easy way described how to resize root. You
only need a very small program (mksparse) and no cygwin. Worked very well for me. Philipp
Here is a precise step-by-step guide, with error checking, to enlarge your coLinux root partition. These
instructions were inspired by the earlier version which is appended below. These instructions make a
copy of your current root partition, except larger.
These instructions improve on the earlier ones in that (1) they are more detailed, (2) they contain error
checking steps to ensure nothing has gone wrong, (3) the invocation of dd is rearranged so that
calculating the correct numbers to use is easier, and (4) they do not need you to install the ext2 file
system tools under Cygwin (important because the standard Cygwin installer does not know where to find
them).
This procedure is for ext3 file systems. It should also work for ext2 file systems, but I have not tried this.
Only minor adaptations should be needed for reiserfs or XFS file systems. The earlier instructions
appended below should have the necessary adaptations.
This procedure assumes your current coLinux root partition is 2 gigabytes (2 * 1024 * 1024 * 1024 =
2147483648 bytes) in size and that you want to expand it to 4 gigabytes (4 * 1024 * 1024 * 1024 =
4294967296 bytes). If your current and desired sizes are different, it should be easy for you to adapt the
instructions. Your host version of Windows must support files of the desired size.
This procedure needs disk space for both your current and new coLinux root partitions, because you will
be using them simultaneously. Your current coLinux root partition is not* enlarged, but rather a new
partition is created that is a larger version of your current partition.
This procedure assumes you have the Cygwin environment installed on your Windows host machine,
including at least these programs: bash, dd, cmp, ls, cp. If you don't have Cygwin installed, it should be
easy to substitute equivalent Windows actions for everything but the instructions using dd. If you can't get
dd, see the instructions for using dd for an understanding of how you might substitute some equivalent
action.
This procedure assumes that your current coLinux root partition has at least these programs installed on
it: resize2fs, e2fsck, shutdown, mkdir, bc, mount, umount, echo (or your shell has echo built in).
In the instructions below, the old root partition file is named gentoo-i586-ext3-2g-deluxe, the old coLinux
configuration file is named default.colinux.conf, the new enlarged root partition file is named gentoo-i686-
ext3-4g, and the new coLinux configuration file is named gentoo-i686-ext3-4g.colinux.conf. You *must*
replace these names by the names you are actually using.
Each step is marked with "Linux", "Cygwin", or "Windows" depending on whether you need to do the step
in your running coLinux, on Windows using the Cygwin tools, or just on Windows with any text editor.
shutdown -h now
(replace the 2 in 2M by the number of gigabytes you are adding. 2M does NOT mean "2 Megabytes" but
2 Million times a block of 1 kByte (bs=1k), so you get 2 Million * 1 kByte = 2 Gigabyte)
Please remember that copying from and to the same disk 'does' take some time.
It _might_ take an hour or more for a 10GB size file on a fast computer !
ls -l gentoo-i686-ext3-4g
echo '4 * 1024 * 1024 * 1024' | bc
cp default.colinux.conf gentoo-i686-ext3-4g.colinux.conf
6. Windows: Edit the new configuration file to add the new partition:
cobd2="c:\Program Files\coLinux\gentoo-i686-ext3-4g"
(the number 2 should actually be the next unused number in your configuration file)
7. Cygwin: Boot coLinux using the new configuration file which still uses the old root partition:
colinux-daemon.exe @gentoo-i686-ext3-4g.colinux.conf
8. Linux: Check that the file system we are expanding is in fact in good shape:
(WARNING: The number 2 in /dev/cobd2 must match the number 2 in index="2" above. Check also with
the mount program that /dev/cobd2 is not already mounted. If you make a mistake in choosing the
correct partition number here, you will probably destroy your existing partitions!)
(-f forces checking, -v means verbose)
(the nice command isn't really needed for a fast machine and a small filesystem)
9. Linux: Use resize2fs in Linux to resize copied file system on new partition:
resize2fs -p /dev/cobd2
10. Linux: Check that the new number of blocks reported by resize2fs (1048576 blocks) multiplied by the
block size (1024 * 4 = 4096 bytes) is correct:
12. Linux: Mount the resized file system and "exercise" it:
mkdir /tmp/newfs
mount -t ext3 /dev/cobd2 /tmp/newfs
umount /tmp/newfs
13. Linux: Shut down coLinux to allow coLinux to use the new larger file system as root:
shutdown -h now
14. Windows: Edit the new configuration file to replace old root partition with the new enlarged partition:
cobd0="c:\Program Files\coLinux\gentoo-i686-ext3-4g"
(you must comment out or remove the line pointing to of the old root partition and change the line
pointing to the new partition per the instructions above)
15. Cygwin: Boot coLinux with the new configuration and the new root partition:
colinux-daemon.exe @gentoo-i686-ext3-4g.colinux.conf
the SAFE way is the same way I create multiple gentoo images:
Requirements: 3 Images
1. source image
2. target image
3. small, bootable image
Boot image 3, when you get to a login, mount image 1 as /mnt/oldroot. mount image2 as /mnt/newroot
(create the filesystem, if necessary).
Now, do ‘cp -ax /mnt/oldroot/* /mnt/newroot/’ and it'll copy all the files.
This is not, however, GROWING the filesystem, it's just making the file biger.
# cd /colinux
# ls -al *img
* rw-r--r-- 1 root root 4294967296 Feb 27 03:32 test-img
What we want to do, is dd onto the end of that file, I'm assuming the block size is 16K, although most
systems will perform better at 32K.
filesize(bytes)/1024(bytes/K) K
or
4192350KB
but we need blocks, not K, so we divide by blocksize now(16K)
4192350/16=262021
this means our image is 262021 16K blocks long... now that we know that, we use dd.
filename=test-img
blocksize=16K
filesize =262021 BLOCKS
We need to figure out how much larger we want it (keep in mind, some file systems don't like files larger
than 2gb, which may require a Raid solution). Lets assume we want to add 1GB. We need to find out how
many 16K blocks that is. 1GB*(1024MB/GB)*(1024KB/MB)/(16KB/BLOCK} or 65536 this means we want
the new image to be 65536 blocks larger than the original.
here's where we start the grow. I'll explain it as we go... We know so far:
I'll assume you know what filesystem the file is (probably ext3). it should be stated in the filename. To
resize ext3, you need to install the filesystem tools for that filesystem in cygwin. For XFS, it's xfs_growfs,
which needs to be run from within Colinux while the filesystem is mounted rw. For ext2, it's resize2fs which
is in the e2fsprogs package, available from http://e2fsprogs.sourceforge.net/ (does also build under
Cygwin) for sanity's sake (the method I KNOW that works)
resize2fs test-img
and you should be done. If you resize the image under cygwin install the e2fsprogs package. The tools
e2fsck and resize2fs.exe are located under /usr/sbin. On cygwin:
(For the image size <new-size>, the units K, M, and G are valid. E.g 2400M, 3.4G)
<Gniarf>here is one small issue: under FAT32, you are not limited to 4 Gb but to 4 Gb minus 2 bytes
(check it if you dont believe me). for some reasons I believe it is safer to use 4095 Mb than 4096 here,
there may be some nasty issues when co Linux tries to write down there, resulting in possible corruption
of the coLinux image.
Alternatively you could also use fsutil as described in HowtoCreateSwapFile which is included in Windows
XP and above:
(remark from Dennis De Winter: replace /dev/cobd0 and /dev/cobd3 by /dev/cobd/0 and /dev/cobd/3
when using Gentoo dedicated to kernel 2.6 !!!!) Shut down coLinux to allow coLinux to use the new larger
file system as root:
shutdown -h now
Remove the old root, and use the one you just made:
cobd3="c:\colinux\10gigfs"
cobd0="c:\colinux\10gigfs"
'Note: despite what it says below, this method is not faster, nor is there any reason to assume it is safer.
82.139.85.20 07:33, 9 December 2007 (UTC)
The (safest) fastest possible way to expand your coLinux drive's space is to create a new virtual drive file
in your Window's c:\colinux directory and use coLinux's Linux commands (maybe Cygwin or QEmu too)
to re-initialize it as an ext3 type drive.
You can start the "shutdown -h now" procedure in coLinux and ALT-TAB to Windows while what comes
next is being done.
First get a file on your Windows system (could be ANY file, but it would be more sensible if it had a size
that was 1024^x - EG: 100M or 2 gigabytes, not 123456789 bytes), I suggest you use your swap file but
you will need to wait for coLinux to finish shutting down before you can use it.
If you want to make whatever file you use bigger, click [START], click "Run" and type "cmd" (hit return) -
this shells you to DOS.
Type this:
cd c:\colinux
copy /b swap_2048Mb+swap_2048Mb drive_1.ext3.4GB
exit
That will take two 2GB swap files and combine them to make one 4GB file. It will do so as quickly as your
operating system can do it. That might take 20 minutes for some people. Add additional "+swap_2048"'s
to increase the size further.
If you just want to use your swap file "as-is" (the size that it is) then copy it to a different directory (slow),
rename it, then copy it back (instant) using Explorer and a few mouse clicks.
Edit your configuration file (might be called c:\colinux\coLinux.conf) and add this after all your other
drives (root / swap / cdrom etc.) :
Type the following to initialize the file to a Linux ext3 type, double check that it is correctly sized, and
check the file system for problems:
Remember to use the correct number above where it says "/dev/cobd3". You might need 2 or 4 - but
NEVER 0. Don't use "0". That should only take 5 minutes for a 10 GB file.
If everything is OK, mount it. If something went wrong re-check your typing. At worst the file on your
computer will not be any good, but what use was the file made from a couple of spare files copied
together?
You might do something wrong and make the file "c:\colinux\drive_1.ext3.4GB") unusable as a coLinux
directory when you type (for example) "ls -l /tmp/newfs" (or wherever it is mounted).
You can NOT wreck your Windows drives (in coLinux) with the above commands (or something close,
but wrong). You can NOT wreck your coLinux drives (in coLinux) with the above commands (or
something close, but wrong). Thus, this method is quite safe.
mkdir /tmp/newfs
mount -t ext3 /dev/cobd3 /tmp/newfs
You can delete the "lost+found" directory if it exists, you don't want two of them.
rm -r /tmp/newfs/lost+found
If you want to move some files from the origonal drive to the new drive type:
Now you can erase "somedirectory" after checking that it copied OK. When you remove "somedirectory"
you can make it re-appear by mounting the copied directory "/dev/cobd3" to "somedirectory" and then
your coLinux drive will look exactly like it did before you started (and nothing will break). You will have
extra space on your drive that you did not have before, that will be the only visible change.
Your coLinux directory (on Windows) (c:\colinux) will look slightly different since there will be a new file and
the coLinux configuration file will have been edited. Other than that Windows will look the same as it did
before. If this is not the case, you need to re-read these instructions.
For Debian (and some other systems) you can auto-mount the file by creating an fstab entry. Type
"nano /etc/fstab" and add a line like this:
When you re-boot and type "ls -l /" you should see a directory called "somedirectory" in your root
directory. That directory is actually the file on your Windows system called "c:\colinux\drive_1.ext3.4GB".
You can copy files from other directories (like /root/downloads) to the new /somedirectory/dowanlods
directory and it will look like you made your root dirve bigger. The two seperate Windows files will operate
as one big HD on your coLinux system. You can do this many times. Each time you do it you are creating
a new drive so there is a disk limit to consider.
If you mess up (a little) in coLinux you will only wreck your "/dev/cobd3" file. Make sure you use
"/dev/cobd?" (whatever comes AFTER the other, existing cobdX files) and DON'T use "/dev/cobd0" in any
of the above instructions (no matter what you think you are try to do). This guarantees that your system
WILL boot when you re-start and you won't loose everything (as you might with some of the following
methods - they warn about this in some of those methods below).
The resulting Linux file system will appear as it did before you started so all your scripts will still work and
you won't need to edit any configuration files.
GAMES
MOVIES
TV
WIKIS
FOLLOW US
OVERVIEW
About
Careers
Press
Contact
Terms of Use
Privacy Policy
Global Sitemap
Local Sitemap
COMMUNITY
Community Central
Support
WAM Score
Help
Take your favorite fandoms with you and never miss a beat
ADVERTISE
Media Kit
Contact