LinuxQuestions.org
Visit Jeremy's Blog.
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 03-20-2010, 04:58 AM   #1
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Rep: Reputation: 17
Making a new partition


My drive is a 160GB and currently having 2 partitions:
  • swap (taking about 2 GB)
  • linux (taking about 155GB)

Here's the fdisk -l
Quote:
Disk /dev/sda: 160 GB, 160039272960 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 255 2048256 82 Linux swap
/dev/sda2 * 256 19457 154232032 83 Linux
I'd like to do the following:
  1. Increase the swap partition to 5GB
  2. Reduce the Linux system partition by 25GB and give this 25GB to a new partition, which I'd like to use for my Data - this should be accessible by both Linux & Windows

Thanks in advance for any help and suggestions.
 
Old 03-20-2010, 07:17 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Something like gparted may be useful to you.

Typically you would run it from a live CD, and use it to non-destructively change the size of your partitions (though you should always back up before repartitioning, it is an inherently risky process).

For a partition shared between Windows and Linux, people have typically used an FAT32 format. However, NTFS support in Linux has become much more reliable in the last few years. You may encounter some issues because the two operating systems have different ways of handling file ownership and permissions.

Last edited by neonsignal; 03-20-2010 at 07:21 AM.
 
Old 03-20-2010, 09:35 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I think you would also need to reinstall the portion of GRUB that is in the MBR. I'm not certain of this. Maybe someone who knows more will comment on that aspect.

A small part of GRUB (or LILO or GRUB2 or whatever you are using to boot) resides in the MBR. That must be able to find the next stage of the boot code that resides in sda2. When the beginning of sda2 moves, I think that breaks the information stored in the MBR when GRUB was installed so that part of GRUB must be reinstalled to once again be able to find sda2.
 
Old 03-20-2010, 09:45 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,751

Rep: Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929Reputation: 5929
There is no reason to move sda2. linux can use multiple swap partitions and/or swap files.
Shrinking sda2 and creating two addition partition would be the easiest and as already suggest it would be best running gparted from a live CD.

Last edited by michaelk; 03-20-2010 at 09:46 AM.
 
Old 03-22-2010, 03:34 AM   #5
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
I booted with the LiveCD and went to gparted from where I did the following:
-Reduced size of /sda2 by 28GB (25GB for the new data partition and 3GB to add to the swap partition)
-Moved /sda2 to the right by 3GB
-Made a new 25GB primary partition for the data partition

but could not increase the size of the swap partition. The move/resize option was greyed out.
How would I go about with this, pls?
 
Old 03-22-2010, 03:44 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by fkasmani View Post
I booted with the LiveCD and went to gparted from where I did the following:
-Reduced size of /sda2 by 28GB (25GB for the new data partition and 3GB to add to the swap partition)
-Moved /sda2 to the right by 3GB
-Made a new 25GB primary partition for the data partition

but could not increase the size of the swap partition. The move/resize option was greyed out.
How would I go about with this, pls?
IDK for sure but two ideas come to mind.

Firstly was the LiveCD using the swap partition? swapon -s can be used to display the active swap partitions. The swapoff command can be used to de-activate swap partitions.

Secondly I have had mixed results with gparted so now prefer to use fdisk and/or cfdisk. These are less fully featured than gparted but this is not relevant for a swap partition which you can simply delete and recreate; they should be available on the LiveCD
 
Old 03-23-2010, 02:47 AM   #7
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by catkin View Post
now prefer to use fdisk and/or cfdisk.
do any of these have graphical front-ends? Iḿ not very comfy with command-line apps.
 
Old 03-23-2010, 02:49 AM   #8
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Yes, Gparted is a fully graphical tool, based on the parted library. See post #2 for the link to the Gparted site @ sourceforge, which will probably have a link where you can download the standalone ISO of Gparted too, which you can burn to a disc and boot it up, and use that to do your partition editing.

Sasha
 
1 members found this post helpful.
Old 03-23-2010, 08:13 AM   #9
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by fkasmani View Post
do any of these have graphical front-ends? Iḿ not very comfy with command-line apps.
I think you're chasing details in the bad part of catkin's advice.

You already know how to use Gparted from a liveCD. That is a perfectly good GUI tool for your purposes. Switching to fdisk or cfdisk wouldn't help.

The better part of catkin's advice was:
Quote:
was the LiveCD using the swap partition? swapon -s can be used to display the active swap partitions. The swapoff command can be used to de-activate swap partitions.
From the problem you described we can be nearly certain that the liveCD was using the swap partition on the hard drive, so that partition cannot be resized.

To solve that, you need to make the liveCD session not use the swap space. The swapoff command can be used after booting into the liveCD to tell it not to use the swap space.
 
1 members found this post helpful.
Old 03-24-2010, 04:35 AM   #10
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by johnsfine View Post
To solve that, you need to make the liveCD session not use the swap space. The swapoff command can be used after booting into the liveCD to tell it not to use the swap space.
Booted the system from the PC/OS LiveCD and loaded Gparted from there, "switched off" swap on for the swap partition and then successfully resized it.

Thanks everyone.
 
  


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
making new partition tavixor Slackware 6 04-04-2005 12:36 PM
making partition for second linux OldSarge Linux - Software 4 01-18-2005 05:38 AM
Making a partition image PhuckFonix Linux - General 6 06-27-2004 01:06 PM
Partition Magic eval not making partition SidA Fedora 7 03-16-2004 05:32 AM
making a new partition zexter Linux - Software 1 12-03-2003 06:26 AM

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

All times are GMT -5. The time now is 03:07 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