Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hey, I am wanting some help/ opinion on whether it is possible to transfer the entire OS from an EXT4 partition/s to XFS partition/s. As it currently stands, my Scientific ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie SL6-A1000's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    120

    Moving SLF partitions from EXT4 to XFS?


    Hey,
    I am wanting some help/ opinion on whether it is possible to transfer the entire OS from an EXT4 partition/s to XFS partition/s.

    As it currently stands, my Scientific Linux Fermi is running a Root and Home partition on 2 seperate hard disks (i.e. Root on Disk 1 and Home on Disk 2) under the EXT4 filesystem.

    I am planning on shrinking both partitions by 50% and creating 2 new partitions under the same format as above only using the XFS filesystem.
    ------------------------------
    Existing Layout:
    Disk 1: SLF-Root 20GB EXT4
    Disk 2: SLF-Home 300GB EXT 4

    Planned Layout:
    Disk 1: SLF-Root 10GB EXT4 (Remove if all is unproblematic)
    Disk 1: SLF-Root 10GB XFS - Expand to 20GB eventually
    Disk 2: SLF-Home 150GB EXT4 (Remove if all is unproblematic)
    Disk 2: SLF-Home 150GB XFS- Expand to 300GB eventually
    --------------------------------
    Booting won't be an issue as i am multi-booting SLF with Debian under GRUB2. The kernel also shouldn't be a problem as SLF is running a custom kernel with XFS support built-in.

    However i am unsure and need some confirmation that doing this won't create errors or incompatibilities with SLF, as opposed to just re-installing it on XFS. As i know the XFS and EXT4 have differences with meta-data, allocation, etc.

  2. #2
    Just Joined!
    Join Date
    Apr 2005
    Posts
    5
    Hi SL6-A100,
    that all sounds feisable.
    Just resize your current partitions and make sure you can still boot up ok.

    Create your new partitions, home should copy fine while booted off the existing partitions, update /etc/fstab and reboot so you are on ext4 for / and xfs for home.

    Next bit would be a bit more tricky.

    I would suggest booting off a boot disk to copy root across, update your fstab and your grub to point to the new partition and then reboot again.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    The biggest problems will be drive UUID's as they are used for /etc/fstab usually, and they will change when you change the file system type. I recommend that you label them, and adjust /etc/fstab to use the LABEL=name instead of the UUID=uuid format. Doing that, you can create/use new file systems/discs for boot drives without changing things, assuming that you set the label accordingly when you create the new file systems before moving data to them. Where this may not necessary is when the file system is on a LVM group.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie SL6-A1000's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    120
    Okay so i am having a problem copying the files.

    I am using the cp -av command from my debian partiton to copy the root directory across, but my problem is that when i do that it copies the whole hierarchy. This means that instead of root be located at the top of the directory it become /mnt then the root directory.
    this is what i did:
    /media = old Ext4 Root
    /mnt = new XFS Root

    Code:
    cp -av /media /mnt
    But as i mentioned above the directory also included the /mnt in the directory. So the new XFS root comes under /mnt/root

    I am thinking this is wrong and will create alot of errors due to the change in file structure. Maybe using rsync would be better? :S

    If there is a solution or a better way to do this, i am open to suggestions...

    Thanks
    SL6-A1000

  6. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    You cannot do this when you have booted into these file systems. You need to boot from a recovery/live cd/dvd/usb drive, create a mount point for both file systems in the live system image, such as /mnt/oldroot and /mnt/newroot. Next you would mount the old ext4 file system on /mnt/oldroot and the new xfs file system on /mnt/newroot. At that point, you can execute the command "cd /mnt/oldroot ; cp -rpPv . /mnt/newroot". That is, move into the old root directory and copy recursively (all files in the tree), preserve attributes and ownership, don't follow symbolic links in the old directory tree, and output information about what is happening.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    One final thing. The live/recovery system may not have default support for xfs. If that is the case, then you will need to run the package manager and install the xfs driver and tools while the temporary system is running. These updates will be temporary until you reboot the system.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #7
    Linux Newbie SL6-A1000's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    120
    I finally did it the right way and not the stupid way i was trying to do it. Thanks.

    The copy and paste work for the file system, structure and grub2's detection but the kernel is now panicing when i start up either the old root or the new root.

    They are complaining about being unable to load VFS, appending the root boot options and findfs.

    Is this referring to fstab or something else?

    I amended my fstab to the following

    New Root (XFS):
    Code:
    LABEL=SLF-Root /                       xfs    defaults        1 1
    LABEL=SLF-Home /home                   xfs     defaults        1 2
    LABEL=SLF-Temp /tmp                    xfs     defaults        1 2
    UUID=7ebe7fea-a4ed-46b7-82ea-55db674c3e5b swap                    swap    defaults        0 0
    Old Root (Ext4):
    Code:
    UUID=0c42ff21-c95e-4954-ae8a-e6dc75385afc /                       ext4    defaults        1 1
    UUID=628bc57c-b49c-4205-8bd2-3d69c75ce9ed /home                   xfs     defaults        1 2
    UUID=02b12201-ae02-4b75-8466-6122a95c5b8e /tmp                    xfs     defaults        1 2
    UUID=7ebe7fea-a4ed-46b7-82ea-55db674c3e5b swap                    swap    defaults        0 0
    Because the error is the same in both cases, i am presuming that its file configuration or lack thereof and not the kernel be incapable?

  9. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,664
    Are you sure you have the xfs driver installed in the kernel and xfsprogs package (tools like fsck.xfs, mount.xfs, etc) installed? On many systems, you need to build a custom configured kernel to get the xfs driver installed. I had to do that for Red Hat Enterprise Linux and clones for version 5.x and eariler (kernels previous to 2.6.32). Current kernels (RHEL 6.x) usually have xfs built into them by default, although you still need to install the xfsprogs package in order to get fsck.xfs and such.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #9
    Linux Newbie SL6-A1000's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    120
    Before i copied the root partition across from ext4 to xfs, i had the home partition already in xfs, booting without any issues. So that wouldn't make sense... If the kernel is able to read an xfs home partition than it should be able to read the root partition in xfs. But xfs isn't the problem (i can still boot using the old root partition). The problem is that both the new and old root partitions now kernel panic and both are panicing about the same problem. This where my previous comment comes in, if both old and new are kernel panicing than that means a configuration has changed that hasn't been accounted for since the copy. I.e. Its not a kernel problem but a config problem (fstab, grub...??)?

  11. #10
    Linux Newbie SL6-A1000's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    120
    So here is the kernel output:

    Code:
    FS: cannot open root device "sda4" or unknown-block (0,0)
    Please append a correct "root=" boot option: here are the available partitions:
    Kernel panic-root syncing: VFS: unable to mount root fs on unknown-block (0,0)
    id: 1, comm: Swapper Not tainted 2.6.32.220-7.el6.x86_64 #1
    Call Trace:
    [<ffffffff814ec3fa>] ? panic+0x78/0x143
    [<ffffffff81c203ed>] ? mount_block_root+0x1ea/0x29e
    [<ffffffff81002930>] ? trace_kmalloc+0x260/0x930
    [<ffffffff81c204f7>] ? mount_root+0x56/0x5a
    [<ffffffff81c2066b>] ? prepare_namespace+0x170/0x1a9
    [<ffffffff81c1f911>] ? kernel_init+0x2e3/0x2f9
    [<ffffffff8100c14a>] ? child_rip+0xa/0x20
    [<ffffffff81c1f62e>] ? kernel_init+0x0/0x2f9
    [<ffffffff8100c140>] ? child_rip+0x0/0x20
    I hope this helps identify what the issue is.

    regards,
    SL6-A1000

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •