LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 04-02-2011, 10:13 AM   #1
dahweeds
LQ Newbie
 
Registered: Nov 2008
Posts: 24

Rep: Reputation: 0
Tutorial: Moving Fedora Linux to a larger partition.


I have finished moving my standard Fedora 14 install to a larger partition. I had a few bugs that others might encounter so I hope this tutorial will get them over the humps. This might work fine for any linux system if you want to move it to new drive or larger partition.

I tried Fedora from a live USB installer on a small partition of my old Windows XP desktop. Fedora was so nice that I decided to scrap M$ and give the whole partition to Fedora. The steps below are not the order I did them, because there were some crashes. I think following them in the order below could avoid the crashes with minimal troubles.

As always, BACKUP EVERYTHING FIRST!

And READ EVERYTHING BEFORE DOING ANYTHING!

And I recommend making a live USB in case there is a problem.
http://fedoraproject.org/wiki/FedoraLiveCD/USBHowTo

Here you go!

Original Setup:
Code:
/dev/sda1  Windows XP about 60GB
/dev/sda2  Fedora 13 from live USB, updated to 14 over time, about 15GB
/dev/sda3  Linux Swap, 1GB
some free space left over
Goal, move fedora to sda1 and boot as if nothing changed.

Steps:
1) Open Disk Utility and scrap the Windows Partition

2) Reformat with EXT4, same as the current sda2

3) Open the terminal and become root with the little minus sign.
Code:
[user@Fedora ~]$ su -
4) Mount larger partion.
Code:
[root@Fedora ~]# mount /dev/hda1 /media/Fedora
5) Copy almost everything from smaller to larger partition
Code:
[root@Fedora ~]# rsync / /media/Fedora --exclude=/proc --exclude=/media -avi
6) Edit /etc/fstab on the larger partition to use the correct UUID for the boot volume. It is the first line in this example which has the / after the UUID.
Code:
[root@Fedora ~]# gedit /media/Fedora/etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Jul 10 20:25:08 2010
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=51b65793-daf4-40b8-a15a-7f15f5f638e1 /                       ext4    defaults        1 1
UUID=d5e417c7-f5d6-4735-8932-6329699b6d4c swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
[
NOTE: How to know the UUID of the new partition?
Code:
[root@Fedora ~]# blkid
/dev/sda1: LABEL="Fedora" UUID="51b65793-daf4-40b8-a15a-7f15f5f638e1" TYPE="ext4" 
/dev/sda2: LABEL="Fedora-13-i686-L" UUID="305f4bb4-926f-4900-b096-a946d200862c" TYPE="ext4" 
/dev/sda3: UUID="d5e417c7-f5d6-4735-8932-6329699b6d4c" TYPE="swap"

7) Edit /media/Fedora/boot/grub/grub.conf to change root entries to the proper partition and to aim the boot command to the proper UUID. In my case it was changing from (hd0,1) to (hd0,0), and the UUID like in the previous change.

Mine originally had a Windows XP on the larger partition, so I removed that entry at the bottom and added a fallback to get to my original system in case something failed. (Something failed, so I was thankful for that.)

There were other entries, but I just show the top one and my fallback. Notice the UUID= on the new partition.

Code:
[root@Fedora ~]# gedit /media/Fedora/boot/grub/grub.conf 

default=1
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.35.11-83.fc14.i686.debug)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686.debug ro root=UUID=51b65793-daf4-40b8-a15a-7f15f5f638e1 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
	initrd /boot/initramfs-2.6.35.11-83.fc14.i686.debug.img
title Fedora (2.6.35.11-83.fc14.i686)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686 ro root=UUID=51b65793-daf4-40b8-a15a-7f15f5f638e1 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
	initrd /boot/initramfs-2.6.35.11-83.fc14.i686.img

#Fallback Entry
title Fedora on 0,1 (2.6.35.11-83.fc14.i686)
	root (hd0,1)
	kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686 ro root=UUID=305f4bb4-926f-4900-b096-a946d200862c rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
	initrd /boot/initramfs-2.6.35.11-83.fc14.i686.img
8) Put grub on the larger partition as the default
Code:
[root@Fedora ~]# grub
grub> device (hd0) /dev/sda 
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
[root@Fedora ~]#
Optional step: Reboot with the recovery drive and rsync again. If you do this add some excludes so that you don't over write the files that were just edited.

Also leave out the front slash of the excludes.

Code:
[root@Fedora ~]# mount /dev/sda1 /media/Fedora
[root@Fedora ~]# mount /dev/sda2 /media/Fedora-13
[root@Fedora ~]# rsync /media/Fedora-13 /media/Fedora --exclude=proc --exclude=media --exclude=boot/grub/grub.conf --exclude=etc/fstab -avi
Remove recovery drive and reboot again.

If all goes well, it is supposed to become the same system, but on the larger partition.


ACK! I Cannot login. The graphical login starts but keeps crashing. I only see a little spinner, and then a blinking line on the top left.

If I do Ctrl + Alt + Delete, the system reboots normally.

I had configured auto login on this system. (If you have not configured auto login, you might be at the login screen but unable to login by any user name.)

You think it is a problem, but it is selinux doing it's job.

I found this error message in the /var/log/messages of the larger partition after using my fall-back boot selection.

Code:
SELinux is preventing /usr/libexec/gdm-session-worker "entrypoint" access on /etc/X11/xinit/Xsession.
So how to fix? I found the answer the fedora bug hunter page.

You have to rebuild the indexes and labels of the system. So, at the grub boot menu, select the option that lets you edit the kernel parameters. Add either a '1' or 'single' to the end of the kernel parameters, then continue booting up.

So I rebooted, hit some key to interrupt and chose:

Quote:
e - edit commands before booting
Then select the second line and add single at the end

Quote:
root (hd0,0)
kernel /boot/vmlinuz-2.6.35.11-83.fc14.i686 ro root=UUID=51b65793-daf4-40b8-a15a-7f15f5f638e1 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet single
initrd /boot/initramfs-2.6.35.11-83.fc14.i686.img
It boots right to the root user. So I put the selinux rebuild index command:

Code:
root@fedora ~]# touch /.autorelabel; reboot
It took about 30 minutes to rebuild, but now it is all there on the larger partition.


I hope it works for you.
 
Old 04-03-2011, 07:23 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Here's what I would have done (assuming I wanted to truly delete the WinXP partition):

1. Boot from any live CD/USB that contains gparted
2. Delete WinXP partition
3. Expand the Fedora partition into some (or all) of the space vacated by the WinXP partition

Normally, I'd keep the XP partition, but shrink it down to the point where it had about 5 GB of free space.

Last edited by RockDoctor; 04-03-2011 at 07:25 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving LVM partition to larger hard drive blainehilton Fedora 2 11-20-2007 02:36 PM
Moving to a larger drive eric_marsh Linux - General 6 12-07-2006 10:32 PM
moving to larger HD musicman_ace Linux - General 4 10-17-2005 03:56 PM
Making the Fedora Partition larger RedRaven Fedora 11 04-29-2005 07:34 AM
How do I make my Linux Partition larger? SeXuaLSoYBeaN Linux - Software 1 10-17-2003 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

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