LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 03-28-2010, 01:44 PM   #1
chickenlinux
Member
 
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Rep: Reputation: 31
Unhappy Change primary partitions to logical partitions AND migrate their data?


I've installed Arch Linux onto my Western Digital SATA drive. I love it, best ever, however, I need the fglrx proprietry driver for better 3-d performace, and decided to create a new partition. I decided to install Linux Mint.

Sadly, in all my noobishness, I forgot about the 4 primary partition limit (oops!) and as I have /, /home, swap, and /boot partitions (all primary) already installed, I have run into a bit of a problem.

I resized my /home partition (almost 500GB) to about 225, and was then told I have over 200GB unusable space.

Is it possible for me to change at least 1 of my primary partitions to logical partitions AND keep all the data intact (AND edit the arch configuration so that it'll still work) so I can install a second linux? I sincerely doubt it, but if there's a way, could someone tell me how?
 
Old 03-28-2010, 03:02 PM   #2
mpier
Member
 
Registered: Jan 2008
Location: Poland
Distribution: Slackware, Arch
Posts: 38

Rep: Reputation: 17
Hi,
should be painless. Create a partition at the end of the drive, move any data into them and delete or modify opening partitions. This could be done without data movement by editing only the partitions table, but don't recommended if you are out of knowledge. Difficult to say, depends on actually arrangement.
 
Old 03-28-2010, 03:47 PM   #3
chickenlinux
Member
 
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Original Poster
Rep: Reputation: 31
Firstly, thank you very very much. Secondly, I'm not entirely sure how to do this. I feel really stupid, and I hope I'm not wasting your time, but could you walk me through this step by step? I've backed up my data, but I'm still scared to death that I'll screw up really badly; I don't want to lose my system.

Here's a partitioning layout as given by "sudo sfdisk -d /dev/sda > partitions":
Code:
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=        1, size=   931769, Id=83, bootable
/dev/sda2 : start=   931770, size=  8353800, Id=82
/dev/sda3 : start=  9285570, size= 30732345, Id=83
/dev/sda4 : start= 40017915, size=488295675, Id=83
Thank you so much for your help so far.
If you have the time, please tell me what to do step by step like I'm a 6 year old.

(This is sort of pathetic -- A fellow installs Gentoo Linux from stage 3 by chrooting from a puppy cd, but cannot partition a hard drive -.-)
 
Old 03-28-2010, 06:10 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Short answer, no.
Delete sda4 (after backup), allocate all free space as an extended partition. Allocate a new logical partition at the beginning of the extended (the extended is just a container for logical partitions). Make this new (logical) partition slightly larger than what sda4 was, just to be safe. With luck you'll be able to mount it as sda5 and use it as if nothing had happened. Else restore your data.
Adjust grub and fstab, and you'll be fixed up.

Do all the above from a liveCD.
 
Old 03-28-2010, 06:37 PM   #5
mpier
Member
 
Registered: Jan 2008
Location: Poland
Distribution: Slackware, Arch
Posts: 38

Rep: Reputation: 17
Yes, but resize sda3 down a little (resize filesystem first) and then create extended sda4 and logical sda5 at the same position as sda4 was before (fdisk -lu /dev/sda shows you). Otherwise the new sda5 will be shifted right, and wouldn't mount.
 
Old 03-28-2010, 10:00 PM   #6
chickenlinux
Member
 
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Original Poster
Rep: Reputation: 31
So, I delete sda4 (muh... worse could happen :P) and then add a new sda4 as a logical volume of sda3, then create sda5 as the new primary that will house my Linux Mint as one big partition? Is that right?
 
Old 03-29-2010, 01:50 PM   #7
mpier
Member
 
Registered: Jan 2008
Location: Poland
Distribution: Slackware, Arch
Posts: 38

Rep: Reputation: 17
No,
sda4 isn't logical, it is primary like sda1,2,3. Sda4 may be extended with logical sda5,6,7... Some programs doesn't show extended partition, only just logical (sda1, sda2, sda3, sda4 (not shown), sda5, ...). If you have data from sda4 backuped, just delete them, and create extended allocating all free space. Samthink like this:
fdisk /dev/sda, d, 4, n, e, 4, Enter, Enter, n, l, ...
 
Old 04-02-2010, 03:00 PM   #8
chickenlinux
Member
 
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Original Poster
Rep: Reputation: 31
But, if I'm only allowed 4 primary partitions, and only primary partitions are bootable, do I delete sda4, create a new _extended_ sda4, & make a logical sda5 for the new OS?

Clearly, I need to brush up on fdisk. I've only been using cfdisk, but it's obviously limited.
 
Old 04-02-2010, 03:06 PM   #9
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Unless you have a suspend to disk pending, you have nothing useful in your swap partition.

Converting a primary to logical would be quite hard, but deleting the swap, moving the other primary partitions and later recreating swap as logical should be easy.

To mess around with the partitions, you need to be booted in a liveCD rather than in any of the partitions you are resizing or moving.

Your liveCD might automatically do a swapon to enable use of the swap partition. In that case you need to use swapoff or equivalent command to disable use of swap before deleting it.

Last edited by johnsfine; 04-02-2010 at 03:08 PM.
 
Old 04-04-2010, 04:15 PM   #10
chickenlinux
Member
 
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Original Poster
Rep: Reputation: 31
I'll go with deleting swap. Sounds simplest. 2 GB of RAM ought to be plenty. I can use a logical volume as swap, correct?
 
Old 04-04-2010, 05:31 PM   #11
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by chickenlinux View Post
I can use a logical volume as swap, correct?
Correct.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing between logical and primary partitions xpromisex Linux - Hardware 3 03-22-2007 07:46 PM
Partitions, logical vs primary AphoxemaG General 15 02-16-2007 01:33 AM
to many partitions? (IDE: 4 primary, 3 logical) drkstr Linux - Software 13 06-14-2006 11:16 AM
Logical drives, and Primary Partitions Infernolinux Linux - Hardware 19 01-09-2006 08:44 PM
primary or logical partitions? blotch Slackware 10 09-09-2004 05:36 AM


All times are GMT -5. The time now is 08:56 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration