LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Partioning a single partition into multiple partitions. (http://www.linuxquestions.org/questions/linux-newbie-8/partioning-a-single-partition-into-multiple-partitions-4175468542/)

Grtyop 07-04-2013 10:19 PM

Partioning a single partition into multiple partitions.
 
Right now, I have a 5GB hard disk with a single partition taking up the entire space of the disk.

Is it possible to split the single huge partition into multiple partitions without deleting the entire single partition ?

Thanks.

qlue 07-04-2013 10:50 PM

Yes it is! But there is always a risk of data loss when partitioning so back-up your important files first.

I use Gparted for partitioning.

Using Gparted, you can shrink the partition to any size that's larger than the used portion of the partition. (you can shrink it from the front or the back, but it's better and faster to only adjust the marker from the back.)

The unallocated space can then be used to create new partitions. Remember that you can only have four primary partitions. If you want more than four, you have to make at least one of your primary partitions an extended partition first.

The most important part is that you cannot repartition a hard drive that is mounted. If you want to repartition the main hard drive, you have to boot from a live CD to do that. I use SystemRescueCD because it already has all the tools included. Some people prefer to use Puppy or some other variant of Knoppix.

But always remember to backup important data first. Accidents do happen, even to the pros. :p

P.S: Are you sure you mean 5GB and not 500GB?

Grtyop 07-05-2013 02:05 AM

Quote:

Originally Posted by qlue (Post 4984479)
Yes it is! But there is always a risk of data loss when partitioning so back-up your important files first.

I use Gparted for partitioning.

Using Gparted, you can shrink the partition to any size that's larger than the used portion of the partition. (you can shrink it from the front or the back, but it's better and faster to only adjust the marker from the back.)

The unallocated space can then be used to create new partitions. Remember that you can only have four primary partitions. If you want more than four, you have to make at least one of your primary partitions an extended partition first.

The most important part is that you cannot repartition a hard drive that is mounted. If you want to repartition the main hard drive, you have to boot from a live CD to do that. I use SystemRescueCD because it already has all the tools included. Some people prefer to use Puppy or some other variant of Knoppix.

But always remember to backup important data first. Accidents do happen, even to the pros. :p

P.S: Are you sure you mean 5GB and not 500GB?

Thanks for the reply =)

I am attaching a 5GB virtual Disk to my Linux VM.

However, I already entered some data on the small 5GB disk, and now I wish to try to re-partition it.

The 5GB contains only 1 single primary partition occupying the entire space.

This 5GB disk is mounted to a self created directory. So what i have to do now is to :
1) unmount this 5GB disk
2) Use gparted to access the disk and repartition it ?

On a sidenote, fdisk cannot be used in such a situation right ?

qlue 07-05-2013 10:07 AM

I've never used virtual disks or virtual machines so I'm not sure to what extent it becomes a different issue.
As for fdisk, I've never used that. but for command line you can use parted. (Gparted is just the Gnome gui for parted anyway.)

jefro 07-05-2013 03:28 PM

A virtual hard drive file can be used in two ways. It can be attached to a host system by some tools so that it might be read but usually not manipulated. The normal way to do tasks on a virtual hard drive file is by booting to either that drive or a different boot media within the VM and then using tools to manipulate it.

For example. Take an iso of gparted or almost any common cd/dvd live image (or rescue image) and boot the VM to it. About all of them boot to a live environment or environment that one can use tools. Fdisk doesn't shrink partitions.

Along this same line one could create another virtual hard drive image and use common tools to partition the new vmhd and format it. Once that is done one could copy over this saved data.


All times are GMT -5. The time now is 11:50 PM.