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 09-17-2006, 01:44 AM   #1
blas
Member
 
Registered: Apr 2003
Distribution: fc5, ubuntu, rhel
Posts: 59

Rep: Reputation: 15
possible to switch 2 ext3 partitions between them?


Hi

Is it possible to switch 2 linux ext3 partitions between them? this is the scenario:

I have 4 partitions on a disk:

Code:
[root@vaiogpg ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+  83  Linux
/dev/sda2            2551        4375    14659312+  83  Linux
/dev/sda3            4376        9482    41021977+  83  Linux
/dev/sda4            9483        9729     1984027+  82  Linux swap / Solaris
I have FC5 installed on /dev/sda1 (20Gb), nothing on /dev/sda2 (15Gb) and some data on /dev/sda3 (40Gb). Now I'd like to change /dev/sda1 to became /dev/sda2 (and /dev/sda2 became /dev/sda1), this way I'll have FC5 installed on /dev/sda2 and /dev/sda1 should be blank.

What I want to do is to keep every data and config on my currently running FC5 but moved to /dev/sda2 (even if I can recreate both partitions to set the correct sizes as they are different (/dev/sda1 should have 15Gb and /dev/sda2 should have 20Gb)). Of course I have to be able to boot FC5 (now in /dev/sda2) using a boot loader (grub).

Is this possible or do I have to reinstall the whole system? If possible, which is the best approach?

Some more info:

Code:
[root@vaiogpg ~]# cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/dev/sda3 /varios ext3 defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
###LABEL=SWAP-sda4 swap swap defaults 0 0
/dev/sda4 swap swap defaults 0 0
Many thanks
Regards
Blas
 
Old 09-17-2006, 07:39 AM   #2
fudam
Member
 
Registered: Feb 2006
Distribution: FC
Posts: 86

Rep: Reputation: 15
Moving the data from sda1 to sda2 can be done using partimage or dd. With dd you have to ensure that you don't try to put more data onto the destination than it cat fit (so you should have less than 15GB of data to move on sda1).

Anecdotaly I have found that resizing ext3 partitions is similar to pulling teeth out of an angry rhino with chopsticks while you're drunk.
 
Old 09-17-2006, 07:42 AM   #3
bigjohn
Senior Member
 
Registered: Jun 2002
Location: UK .
Distribution: *buntu (usually Kubuntu)
Posts: 2,692
Blog Entries: 9

Rep: Reputation: 45
I suppose it's possible. I'd guess that you'd have to copy the entire contents of sda1 to sda2 and then make sda2 bootable. You'd have to change the mount points so that the system knows that it's got too boot the right partitions etc etc.

I should guess, that if you're not very familiar in doing stuff like that, then it'd be easier to re-install the system, but make sure that you tell the installer NOT to format any partition that you want to retain the data on. Then you should just be able to tell the installer that you want to have sda2 as the / partition with nothing done to sda's 3 and 4.

Note that the fstab you posted, doesn't have any mountpoint for sda2 anyway so it may be worth tidying up you partitions first, then trying to work out what it is that you want to do with them.

regards

john
 
  


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
Accessing other ext3 partitions Bakoulou Linux - General 3 04-23-2006 03:17 PM
Resizing ext3 partitions! alur3n Linux - General 3 10-03-2005 07:29 PM
How to resize ext3 partitions? VincentB Linux - General 1 05-26-2005 11:56 AM
Combining EXT3 Partitions Mr_Munkey Linux - Hardware 4 03-14-2005 09:23 AM
Can I have some partitions be ext2 and some be ext3? WorldBuilder Linux - General 7 05-09-2003 03:49 PM

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

All times are GMT -5. The time now is 05:45 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
Open Source Consulting | Domain Registration