You are not logged in.

#1 2011-11-07 07:13:38

ElKatrina
Member
Registered: 2011-10-28
Posts: 32

[SOLVED] - Changing the root file system to a different disk

Hi,
I ran out of disk space on my / partition so I decided to buy a new hard drive, and copy everything over (but with different sized partitions). Hoewever, Arch is still using the old / partition rather than the new one.

My new home partition is mounted on /home, as I expect. But for some reason, both the old and the new root partitions are mounted on /. Furthermore, I know that the old disk is being used for the root filesystem because conky tells my that it's 94% full, which is how full the old / on my old disk was.

Here are the things I tried:

First of all, I changed my fstab so that the root partition on my new disk gets mounted as /. (I also changed it for my /home partition similarly). Here are the relevant lines from my fstab:

LABEL=new-hitachi-root                    /         ext3 defaults 0 1
LABEL=new-hitachi-home                    /home     ext3 defaults 0 1
UUID=3c1c1940-693f-4428-aa89-65e1403241f7 /old-home ext3 defaults 0 1
UUID=4a84f8ae-4bad-4acf-8573-1a7b244b416c /old-root ext3 defaults 0 1

After this, gparted reported that my old root partition was mounted under both / and /old-root. My new root partition is mounted under /, also. (So I have two partitions mounted under /, my old and new root partitions. However, the system is using the old root partition, since conky still tells my that / is 94% full).

I'm not sure what else to try. I tried messing around with /boot/grub/menu.list, but I'm not sure how to modify it, I keep making my system unbootable. At the moment it looks like

title  Arch Linux
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-uuid/4a84f8ae-4bad-4acf-8573-1a7b244b416c ro
initrd /kernel26.img

(or it did look like that, before I modified it). That seems to be right, because the root entry says (hd0,0), which is the same as /dev/sda, which is the disk where my new root partition is.

Cheers for any help! I'm pretty stuck until I can get some more space on my root partition.

Last edited by ElKatrina (2011-11-08 02:06:54)

Offline

#2 2011-11-07 07:30:02

ElKatrina
Member
Registered: 2011-10-28
Posts: 32

Re: [SOLVED] - Changing the root file system to a different disk

Some more background information:

I have 3 partitions: /, /home, and /boot. I created three partitions on my new hard drive, and used cp -a to move files one partition at a time. However, I didn't copy the /proc directory over to my new hard disk. I also didn't copy the /home directory onto the new / partition on the new drive, or the /boot directory; I copied each of these on to their respective partitions on the new hard drive. Not sure if all of this was the right way to go about it...

Last edited by ElKatrina (2011-11-07 07:30:41)

Offline

#3 2011-11-07 07:42:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] - Changing the root file system to a different disk

kernel /vmlinuz26 root=/dev/disk/by-uuid/4a84f8ae-4bad-4acf-8573-1a7b244b416c ro

points to /old-root, not sure you want that. You're still using the old naming scheme from before linux 3 kernel.

I don't see the /boot in your fstab ...

Offline

#4 2011-11-07 07:42:53

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,557

Re: [SOLVED] - Changing the root file system to a different disk

and did you tell your bootloader to use the new / ?

Offline

#5 2011-11-07 07:46:15

ElKatrina
Member
Registered: 2011-10-28
Posts: 32

Re: [SOLVED] - Changing the root file system to a different disk

karol, thanks. Any idea how to get it to point to my new disk? I tried

root=/dev/disk/by-label/new-hitachi-root ro

but I couldn't boot from that, I got loads of errors... it couldn't find proc, it didn't even know the host name, loads of other errors. What is the new naming scheme?

bangkok_manouel, do you mean grub? I modified /boot/grub/menu.list as described above, is there anything else I should do?

Edit: I didn't post the whole fstab file, but boot is definetly in there. Actually, I'm still booting from the old disk, since I didn't want to boot from the new one until I got root and home right. (Is this bad?)
My whole fstab:

devpts                 /dev/pts      devpts    defaults            0      0
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0
LABEL=callisto                            /callisto ext3 defaults 0 1
LABEL=thebe                               /thebe    ext3 defaults 0 1
LABEL=new-hitachi-boot                    /new-boot ext3 defaults 0 1
LABEL=new-hitachi-root                    /         ext3 defaults 0 1
LABEL=new-hitachi-home                    /home     ext3 defaults 0 1
UUID=3c1c1940-693f-4428-aa89-65e1403241f7 /old-home     ext3 defaults 0 1
UUID=4795b52b-f849-4bcd-8032-d1634550afdc /boot     ext2 defaults 0 1
UUID=4a84f8ae-4bad-4acf-8573-1a7b244b416c /old-root         ext3 defaults 0 1

Last edited by ElKatrina (2011-11-07 07:52:34)

Offline

#6 2011-11-07 09:04:47

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [SOLVED] - Changing the root file system to a different disk

I once used rsync to copy Arch to another partition, and then I only had to change fstab and menu.lst. How I did it was, first make backup.lst (which I saved in my home):

# Include
+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero

# Exclude
- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- lost+found/
- /var/lib/pacman/sync/*
- /mnt/*
- /media/*
- /home/username/.gvfs

After that I mounted the root partition on /mnt and "mkdir /mnt/home" then mount the home partion on /mnt/home. Then I run

sudo rsync -av --delete-excluded --delete --exclude-from=/home/username/backup.lst / /mnt/

(One thing you did was to exclude the whole folder /proc, instead of just exclude the content of it.)

Offline

#7 2011-11-07 09:33:31

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [SOLVED] - Changing the root file system to a different disk

To find out UUID for your new partitions, run "blkid" as root.

Why do you add both the old and the new partitions in fstab? No need for that, it just makes it messy...

Make shure you have copied everything that's needed, and then just change UUID in fstab and menu.lst.

Edit: Now I can see one more thing that you missed. You have to make the folders /home and /boot on your root partition, because those empty folders are the mount point for your boot and home partitions.

Last edited by Lennie (2011-11-07 09:48:25)

Offline

#8 2011-11-08 02:02:03

ElKatrina
Member
Registered: 2011-10-28
Posts: 32

Re: [SOLVED] - Changing the root file system to a different disk

Guys, thank you all so much. So here's the full solution:

  • When copying over to the new partition, make sure you include an empty proc folder in the root partition, as well as following all the rules that Lennie mentioned.

  • If using GRUB, you need to tell it about your new root partition. I had to change my /boot/grub/menu.list to

    title  Arch Linux
    root   (hd0,0)
    kernel /vmlinuz26 root=/dev/disk/by-label/new-hitachi-root ro
    initrd /kernel26.img
  • You should also change your fstab so that all your new partitions are mounted correctly.

  • At this stage, you should be able to boot, but there are a few niggles. You need to make sure that /var/log exists, otherwise the boot process and X won't be able to write logs as they start up. (I guess Lennie covered that, but I missed it). You also need a file called /etc/machine-id, otherwise dbus won't be correctly configured... for some reason, this wasn't created for me and I couldn't run firefox. Just run

    dbus-uuidgen > /etc/machine-id

    and that should sort you out.

Thanks all again, I've got a lovely free root partition now. How do you mark topics as solved...? Can't edit the original title for some reason.

Last edited by ElKatrina (2011-11-08 02:05:57)

Offline

Board footer

Powered by FluxBB