Expand the Ubuntu virtual hard disk space of CoLinux

Source: Internet
Author: User
A few months ago, a colinux instance was installed on window, which is exceptionally easy to use. The linux version is Debian, and the graphic interface is not installed, which is not fast. In this way, it is very convenient for program development, and you can directly mount the windows disk for file access, so you can always open colinux and write PHP or Erlang programs on windows, then you can run it in Linux immediately. It took two days to uninstall the original dual-system Ubuntu. When fashion

A few months ago, a colinux instance was installed on window, which is exceptionally easy to use. The linux version is Debian, and the graphic interface is not installed, which is not fast. In this way, it is very convenient for program development, and you can directly mount the windows disk for file access, so you can always open colinux and write PHP or Erlang programs on windows, then you can run it in Linux immediately. It took two days to uninstall the original dual-system Ubuntu.

I didn't think too much about fashion. By default, I only provided 2 GB of space. After a while, the above-installed programs also increased, as a result, the 2G space is a little too short. I searched the internet for how to expand a virtual hard disk. There are two methods:

1. Create a new image file and mount it to colinux.

2. directly create a larger image file, copy the original content to the new image file, and then attach it to the new image file. (The second type is said to be dangerous)
The process is as follows:

[1] Create a new file that you want to expand on a relatively idle disk in the window
#5G = 5*1024*1024*1024 = 5368709120
F :\> fsutil file createnew F: \ debian \ root5 G. ext3.img 5368709120
The file F: \ debian \ root5 G. ext3.img has been created.
[2] modify the startup configuration file xxxx. conf of colinux and add the following line.
# File contains the root file system.
Cobd0 = "F: \ debian \ Debian-5.0r2-lenny.ext3.2gb"
Cobd1 = "F: \ debian \ root5 G. ext3.img"

[3] Add a mount point and create a folder with any name.
Mkdir/fs

[4] format the File System (time-consuming)
Mkfs. ext3/dev/cobd1

[5] mount the new file system or directly add it to/ets/fstab for automatic mounting upon startup
Mount/dev/cobd1/fs
# Check that the task has been completed.
Df
 
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/cobd0 2064208 1581712 377640 81%/
Tmpfs 127984 0 127984 0%/lib/init/rw
Udev 10240 2772 7468 28%/dev
Tmpfs 127984 0 127984 0%/dev/shm
/Dev/cobd1 5160576 141436 4756996 3%/fs
This completes the first method mentioned above. Next, we will transfer the default method to the new image file for capacity expansion.

[6] copying all previous files to a new device takes longer.
Cp-ax // fs

[7] copying device points
If [-d/dev/. udev]; then cp-a/dev/*/fs/dev/; fi
Check that the file system mounted in the new file/fs/etc/fstab only contains/dev/cobd... Starting,
Use df to check disk usage and proceed to the next step.

[8] run the following commands in sequence:
Sync
Cd/
Umount/dev/cobd1
Shutdown-h now

[9] modify the xxxx. conf STARTUP configuration file on the window to point to the new image file.
# File contains the root file system.
# Cobd0 = "F: \ debian \ Debian-5.0r2-lenny.ext3.2gb"
Cobd0 = "F: \ debian \ root5 G. ext3.img"

[10] Okay, Good Luck, start colinux again
Colinux :~ # Df
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/cobd0 5160576 1652972 3245460 34%/
Tmpfs 127984 0 127984 0%/lib/init/rw
Udev 10240 2772 7468 28%/dev
Tmpfs 127984 0 127984 0%/dev/shm
# Well done !!

Do not delete the original image files. After a period of time, make sure that there is no problem and you can lose it. If there is a problem, you can change it back immediately, which is very convenient.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.