LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-30-2003, 12:02 AM   #1
naijin
Member
 
Registered: Nov 2003
Location: Montreal, Canada
Posts: 36

Rep: Reputation: 15
Resizing Linux' partitions.


I'm using Mandrake 9.2 and Windows XP. I'm planning to get rid of Windows, since I barely use it anyway. In theory, I want to do it like that:

- Copy important files from Windows' partition to Linux;
- Erase the Windows' partition using Partition Magic;
- Resize the Linux partition (add the unused space, left after Windows "uninstall");

Basically, I want to know if this method can screw up my Linux partition, and if yes, how to avoid it.

Last edited by naijin; 11-30-2003 at 12:03 AM.
 
Old 11-30-2003, 12:16 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
As far as I know, it can, since PM is unreliable. YMMV. Probably be better off just deleting the partitions and recreating them with fdisk and mounting them under your tree, or resizing them with a Linux tool like parted, rather than what is essentially a Windows tool. But you'd probably be fine either way.

I've never used PM - just my observation of a lot of posts by those who have. And parted or any piece of software is not 100% perfect, of course.
 
Old 11-30-2003, 12:19 AM   #3
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Well, I'm no expert on linux filesystems, but I look around here and there and haven't ever come across anything that sounded reliable as far as resizing linux partitions. I think there are a few apps if you are using ext2 (maybe ext3 as well). I am running on reiserfs. There is a way to resize and maybe not lose my data, lol.

Best thing to do if you haven't had your *nix install very long, is just format and reinstall. Burn the important stuff to cd for later use. If you want to delete windows partitions, fdisk is a helluva lot faster and easier than PM. PM is terrific for resizing partitions, but it's overkill for deleting/creating partitions.

You could copy the windows files to you existing linux partition, then delete windows, and then create new paritions for you to use in linux with the free space; like moving your /home directory over to its own partition (which is a good idea anyway), thus leaving your linux system still intact.
 
Old 11-30-2003, 12:35 AM   #4
naijin
Member
 
Registered: Nov 2003
Location: Montreal, Canada
Posts: 36

Original Poster
Rep: Reputation: 15
Quote:
moving your /home directory over to its own partition (which is a good idea anyway), thus leaving your linux system still intact.
Can you explain this part more in detail please?
 
Old 11-30-2003, 12:53 AM   #5
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Sure. Here is the way I have Slackware set up at present:
13gb's /
13gb's /home
The / directory includes everything. Everything except /home that is. By keeping your home directory on a seperate partition you are 'safer' in case of some system disaster or just the want/need to reinstall. In the case of a reinstall, all your personal application settings and personal data would remain safe on your /home partition. I have reinstalled, only to boot right up looking at all the same stuff I had just before I reinstalled. Makes life easier.

So... You could delete the windows partition. Lets say that frees up 10gb's. You could then create a new linux partition in that 10gb's, and copy the /home directory over to it. Then you would have to modify your /etc/fstab file to reflect the changes. If you logged in as root, you should have no trouble copying the home directory to a new partition. I say 'copying' because it is prb a good idea to get it done and verified before actually deleting the old /home.

Here's the steps then:

example for your drive
-------------------------
hda1 = windows 10gb
hda2 = linux 10gb
hda3 = linux swap

1. log on as root.
2. use cfdisk to remove the hda1 (replace 1 with your actual windows #)
3. Still using cfdisk, create a new partition in the free space. You'll need to specify the type. I believe Linux is # 83 in the menu. Make note of whatever hdx is replaced with. Should still be hda1, but...
4. Now, open up /etc/fstab in your favorite editor and change the....

Tell you what. If this is what you would like to do, go ahead and post your fstab file so I can be more specific here. It will help minimize the chance of something bad happening and maximize the chance of my words making sense

Last edited by Scruff; 11-30-2003 at 11:19 AM.
 
Old 11-30-2003, 07:57 AM   #6
fatgod
Member
 
Registered: Mar 2002
Location: Edinburgh, Scotland
Distribution: Suse 7.2, Gentoo 1.4, Solaris 9
Posts: 661

Rep: Reputation: 30
"haven't ever come across anything that sounded reliable as far as resizing linux partitions."

Thanks becasue there is no such thing as a safe way to resize any FS partition. It's an entirely stupid concept, IMNSHO
 
Old 11-30-2003, 08:49 AM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Well dagnab it I feel a rant coming on!

Resizing a partition may be stupid to some peoples but some of us have to do this all the time at the work place because the computer specs have to be met before going out to the customer. For instance, on a particular computer the recovery partition is 1Gig and the working partition is about 34 GB.

We use Partition Magic on a bootable cdrom all the time to get the partitions back into specs and I have yet to find anything unreliable about it!

I also use the Linux version called qtparted which nicely comes on a rescue cdrom from http://www.sysresccd.org/ .

The Partition Magic cdrom gets used more at work because...
1. That cd happens to have the other tech tools on it
2. Many of the techs are not Linux converts yet.

At any rate, I have never had any problems resizing any partitions, NTFS or otherwise.
 
Old 11-30-2003, 10:24 AM   #8
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Quote:
Originally posted by fatgod
Thanks becasue there is no such thing as a safe way to resize any FS partition. It's an entirely stupid concept, IMNSHO
I have resized hundreds of Windows partitions including NTFS without issue, and there are people working on apps to safely resize Linux partitions as well. It is simply a necessity. The method I was referring to with reiserfs, is making note of the starting block to the part you wanna resize, then deleting the partition and creating a new; larger one making sure to use the same starting block. Sounds like a dangerous practice to me

Last edited by Scruff; 11-30-2003 at 11:16 AM.
 
Old 11-30-2003, 11:12 AM   #9
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
i must say that i have never had problems with partition magic; i've used it from the first day i learned about computer partitions (thanks to the PM tutorial) to my first distro (redhat) and up until i started using fdisk with slackware to quickly create and destroy linux partitions

i still use it to resize my ntfs partitions, but i must true the fact that creation and destruction takes far too much time and effort with PM

it saddens me, though, because i just got rid of redhat and now i have an empty ext3 partition next to my slack partition (also ext3) however fdisk cannot merge or resize partitions and for some reason PM won't merge them either

does anyone know of a way to merge two ext3 partitions, mostly using windows PM?
i do not yet feel comfortable with using something else like qtpart
 
Old 11-30-2003, 11:44 AM   #10
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
How about deleting the unused ext3 partition and resizing the good ext3 partition to use the available space?
If you have important data and you are not comfy about this, make a backup first.
 
Old 11-30-2003, 01:57 PM   #11
naijin
Member
 
Registered: Nov 2003
Location: Montreal, Canada
Posts: 36

Original Poster
Rep: Reputation: 15
Scruff

I did as you told me: erased the Win partition using cfdisk, and made it a Linux partition [#83] (It's still hda1). Here's my /etc/fstab file (I erased the line that mounted the Win partition):

/dev/hda3 / ext3 noatime 1 1
/dev/hda2 /boot ext3 noatime 1 2
none /dev/pts devpts mode=0620 0 0
none /mnt/cdrom supermount dev=/dev/scd0,fs=udf:iso9660,ro,--,iocharset=iso8859-1 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,sync,codepage=850,iocharset=iso8859-1,umask=0 0 0
none /proc proc defaults 0 0
/dev/hda5 swap swap defaults 0 0

Now, how do I mount that new Linux partition?

Here's my partition table (please indicate if I need to change anything here):

Name----Flags---Part Type---FS Type----Label-----Size
hda1--------------Primary------Linux------------------31461.22
hda2-----Boot----Primary------Linux ext3--/boot-----108.39
hda3--------------Primary------Linux ext3-------------7369.86
hda5--------------Logical------Linux swap------------1068.32

BTW, when I tried setting the type Linux Extended(thinking that I will just add the line /dev/hda1 /mnt/extra_part ext3 in /etc/fstab) instead of Linux for the new partition, it didn't let me. Why?

Last edited by naijin; 11-30-2003 at 02:09 PM.
 
Old 11-30-2003, 02:19 PM   #12
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Ok. First, you'll need to create the filesystem for hda1. Might as well stick with ext3 like the others, so:

*note: you should boot and logon as root. You can't be 'user' as you would then be making use of your /home dir that we need to change.

Create new partition:
#cfdisk

*Make note of your current fstab lines; particularly the location on the drive (hdX) that each file is mounted at.

Make sure it's not mounted: # umount /dev/hda1
# mkfs.etx3 /dev/hda1

Now, change the name of your current /home directory:
# mv /home /home2
Create the new /home directory:
# mkdir /home
Mount it as the new partition
# mount /dev/hda1 /home
# cp -a /home2/username /home/

Check to see that all your data was successfully copied:
# ls -a /home
also: # ls -a /home/youruserhere

Open up fstab in your fav editor, and create this line:
/dev/hda1 /home ext3 defaults 1 2
While your here, run the command 'df' of 'cfdisk' to check all your current partition/file numbers and check it against your fstab. Make sure none of the locations have changed since creating the new partitions (ie. hda3 is now hda4). If they have, simply change the entry so at boot each partition is mounted properly. You may also need to edit /etc/lilo.conf if any of the boot partitions have changed. If you edit lilo.conf, run the command # /sbin/lilo to reconfigure it with the new parameters.

At this point you should probably reboot to make absolute certain it went ok. If it did, and you're able to see all your /home stuff like it always was, then you can do this:
*** /home2 is your safety net. It's is the contents of your original home dir, so make very sure everything is cool before removing it. If you reboot and everything doesn't seem ok, don't panic. You can logon to X as root, and you would still have the /home2 as a backup. In that case, just come on back and we'll figure out what went wrong. Otherwise:

# rm -rf /home2
BE EXTREMELY CAREFUL with the rm -rf command. It WILL remove everything if you're not careful. If you were to do: rm -rf / you would destroy your system. triple check this command before hitting enter.

That should be it

Last edited by Scruff; 12-17-2003 at 06:53 AM.
 
Old 11-30-2003, 03:50 PM   #13
naijin
Member
 
Registered: Nov 2003
Location: Montreal, Canada
Posts: 36

Original Poster
Rep: Reputation: 15
After doing everything like you said, X doesn't want to load under my username. It said it couldn't write to the $HOME path variable (or something similar to that), so chmod'ed the /home dir to 777, but that didn't help either. CLI works though.
 
Old 11-30-2003, 03:54 PM   #14
Scruff
Member
 
Registered: Oct 2002
Location: Stoughton, MA
Distribution: Gentoo x86_64 & PPC
Posts: 949

Rep: Reputation: 30
Ok. Try # chown -R yourusername /home/yourusername
This is of course, assuming that your home directory is @ /home/yourusername.

check to make sure. ls /home
your username should be shown directly after /home/ if all is good.
 
Old 11-30-2003, 04:23 PM   #15
naijin
Member
 
Registered: Nov 2003
Location: Montreal, Canada
Posts: 36

Original Poster
Rep: Reputation: 15
Almost there.
I can load up into my account with KDE, but not with GNOME (WM that I was using before). Actually, it "loads" it but with like one app(gkrellm) and a ton of blank error messages. I'm guessing that there were some config file for GNOME that got misconfigured or something and KDE made brand-new ones for itself. Any ideas how to "reload" GNOME if the problem is what I think it is?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing Linux Partitions Sociologo Linux - Software 2 10-28-2003 03:13 PM
resizing linux partitions quantumechanix Linux - General 2 09-21-2003 05:10 PM
resizing partitions in linux jimieee Linux - Software 1 09-03-2003 12:41 PM
REsizing the Linux partitions noname Linux - Software 9 08-01-2002 01:25 PM
Resizing Linux partitions/Mounts Dave Campbell Linux - General 14 06-25-2002 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration