Click to See Complete Forum and Search --> : repartitioning existing drive


sleepingbear
11-25-2003, 12:17 PM
Hello all,
After getting KDE (and the rest of Slackware 9.1) to work on my 2GB drive hdd, I started getting errors that my disk was full. After checking with the df command, I realized that I have to steal from my other HD, hda, that was primarily used for Windows. That HD is 20Gb which is already partitined in two 10Gb. What I want to do is split the second 10Gb partition, keep 5Gb for windows and use te rest for my linux system.
I have read up on fdisk and I believe that this will not be a problem. Here is my question to everyone:

What type/size partiitons should I create. (QM broke)
swap partition
partition for /var
partition for /home
partition for /root

Currently all is in the hdd1 partition. The only other bits of info that I can think might be usefull is that I want to use my computer as a web server and as a normal workstation. Also my partition printout from fdisk:


Device Boot Start End Blocks Id System
/dev/hda1 * 1 1241 9968301 c W95 FAT32 (LBA)
/dev/hda2 1242 2481 9960300 f W95 EXT d (LBA)
/dev/hda5 1242 2481 9960268+ f W95 FAT32

/dev/hdd1 * 1 1023 2062336+ 83 Linux

harrysholycows
11-25-2003, 03:27 PM
It depends. The partition that windows is on you can only repartition using windows (if you have 2000 or xp then i can explain how- you go into control panel, then into administrative tools, then into computer managment, then click on disk managment. then by right clicking on the drive, you can change drive letter, format, remove partitions, add partitions. just remember that no drive can have more than 4 partitions).

Here is how to do it if you do not have windows 2000:

If the second partition of 10 gigs is the one you want to split into two partitions AND THIS SECOND PARTITION DOES NOT HAVE WINDOWS ON IT NOW, then you can do that with fdisk. If it has windows on that partition, you can not repartition it without losing windows to the best of my knowledge.

Go to windows and make a boot disk (or rescue disk) and make sure you have fdisk.exe on it. You will have to boot with this boot disk, and then you can run fdisk.

You want to make sure you do is not remove or do anything to the partition that has windows on it, or you will delete windows and not be able to use it.

To the partition without windows, you want to delete that partition, then you can add two more partitions to it, 5 gigs each. You will then have to reboot for the partitions to be added, the you can format those new drives for whatever OS or data you want.

DMR
11-25-2003, 07:43 PM
In terms of what Linux partitions to create, you should probably copy the /usr filesystem onto the partition you make on hda. Most of your installed programs go into /usr and its subdirectories, so getting it out from under your / partition should give you back a fair amount of free space on hdd (2G isn't a heck of a lot to start with, after all).

A couple of different ways of doing this are given in this thread (http://www.justlinux.com/forum/showthread.php?threadid=96938&perpage=15&highlight=tar%20partition&pagenumber=1). Read the thread carefully before you do the switch and you should be fine. If you have any further questions about the process, ask us before you start the process; moving critical filesystems around without knowing what you're doing can lead to endless hours of fun trying to rescue your system...

:p

sleepingbear
11-25-2003, 08:36 PM
Thanks. Windows is on hda1. I had windows files (mp3, jpg, user files basically) on hda2/5. I then moved the files to hda1. hda2/5 is now empty. When I split hda2/5, I'll have a 2 Gb and a 5Gb partition.

Should I move my root to the 5Gb partition? How much (percentage) do I need for my /var? I'm thinking about putting the /var and /home on the 2Gb drive.

Should I have my /root on the same partition as the rest of the system? I figured that I should keep my /var and /home seperate as they can be a storage hog.

How about a swap partition? I believe that I have a swap file from an older version but I'm not sure if my system is configured to use it. I have 256Mb of RAM. Should I even bother?

sleepingbear
11-25-2003, 08:37 PM
Thanks DMR. Just read you post. Will continue with my homework.

harrysholycows
11-25-2003, 08:50 PM
I would do a swap partition at least the size of your ram, up to double the size of your ram. 256 megs is a nice amount of ram for most desktop work.

DMR
11-25-2003, 08:52 PM
OK. I can give you some answers to your questions, but it might now happen until tomorrow. I'm rebuilding one of my other systems right now and just got a bunch of system barf concerning my partition table, so I think I've got my work cut out for me tonight... bugger!

sleepingbear
11-26-2003, 11:01 AM
ok. Deleted hda2 and hda5 (still not sure why there were two.) I created hda2, hda3, and hda4

hda2 is 5125Mb and formatted for W95 FAT32 (LBA)
hda3 is 4869Mb and is 83 Linux
hda4 is 256Mb and is 82 Linux Swap

I have yet to move any files.
What is the command to check on the disk size of a directory and its contents

Satanic Atheist
11-26-2003, 11:42 AM
Originally posted by harrysholycows
just remember that no drive can have more than 4 partitions
That's entirely correct, but you fail to mention that no drive can have more than 4 primary partitions.

One and only one of these partitions can be an extended partition. Within this extended partition, you can have a further 10 or so "logical partitions" more commonly known as logical drives. This is a nice, handy, effective way of overcoming old XT technology.

If you repartition your /dev/hda drive, you will lose Windows if you mess with that specific partition (if you delete a partition on the same drive that is not being used by Windows, you will not lose Windows).

There are three ways to deal with this:

1) Wipe Windows, repartition, reinstall Windows and repair the MBR.
2) Copy Windows to another partition, repartition, copy it back, finish repartitioning and repair the MBR. Get ready to reinstall Windows anyway.
3) Use PartitionMagic from PowerQuest. Not free software, but will resize any filesystem easily and without losing data.

James

DMR
11-26-2003, 08:40 PM
Originally posted by sleepingbear
What is the command to check on the disk size of a directory and its contents

du -ch directory_name

Will list the size of each file in the directory_name specified, and also the entire total size of directory_name.

sleepingbear
11-26-2003, 08:52 PM
Windows works fine with the new partition scheme. I now have my two exta linux partitions on hda. Windows is also happy with hda2. I never touched hda1 which is 10Gb and has the win98SE OS. The only beef with windows is that the screen has been moved to the right. I'll take a pic and show it tomorrow.
Do I have to format this drive (make it ext2) before I can use it or is this already done when I set it to 83 Linux. If no, I think I'm ready to start moving directories.

sleepingbear
11-28-2003, 12:25 PM
Okay, status update:

I formatted the partition
#mke2fs -c -v /dev/hda3

mounted it to a temporary directory
#mount -t ext2 /dev/hda3 /mnt/temp

transferred the files to the new partition. (all 1.2Gb worth)
#cd /usr
#tar cf - . | (cd /mnt/temp; tar xvf -)

I then created a file in /mnt/temp called newone
In /usr I created a file called oldone

I then added this line to /etc/fstab:
/dev/hda3 /usr ext2 defaults 1 2

after rebooting, I checked /usr: it had the file newone.
To me, this looks like it was a success. The only thing Ièm nervous about is removing all the old files.
I believe that I have to unmount /dev/hda3, remove the files (cd /usr then rm -r *), then mount /dev/hda3 again.

This is just about final so I want to see if this makes sense to everyone.

DMR
11-28-2003, 05:02 PM
Sounds like you've got it right.

If you're paranoid about deleting the original /usr's contents, you could make a temporary Linux partition in the space you're reserving for Windows and move the files there. After remounting your new /user, work with the system until you're comfortable that everything works. At that point, you can delete the temp partition where you saved the original /usr files.

sleepingbear
11-29-2003, 01:58 AM
Wooo! All is working now! Thanks DMR and all others who took the time to write.

DMR
11-29-2003, 01:38 PM
Sweet- Glad it worked out!

:)