Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Different file systems, same partition. Practical?

    I've inherited a machine with everything in just one partition on an ext3 filesystem. I'd now like to set some of the disk up as XFS or BTRFS, and though I can see that I can do that by using a liveCD when / is not mounted, I was wondering whether the following is a practical alternative. I can set aside a part of the h/d and set it up with my chosen filesystem doing (for approximately 1GB size) :

    $ dd if=/dev/zero of=target.img bs=1024 count=1000000
    $ mkfs.xfs target.img
    $ mkdir portal
    $ mount -o loop storage portal

    I can now access the new (in this case) XFS filesystem through the directory "portal", and indeed it shows up as a separate "partition" via "df -h", i.e:

    $ df -h
    Filesystem Size Used Avail Use% Mounted on
    <... snip ..>
    /dev/loop0 996M 26M 971M 3% /disk2/test/portal

    and it's the required file system type:

    $ file storage
    storage: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)

    My question is: Have I set myself up for a fall by doing this, or is it a valid way to make available a different type of file system without repartitioning the disk?

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    It's fine - it's just a file that is formatted as a filesystem. You can copy the resulting file off onto other systems or into backup systems, etc. so it has some valuable uses. The main drawback that I can see is that, as the original file is stored on another filesystem, then you're imposing the overhead of both filesystems on your read-write.

    There are alternatives - you could re-partition your main drive so a native partition is available for use (there are some partition management tools available for Linux that would let you resize, just make sure you've got backups before you start). You could also invest in a new hard disk and put it into the computer alongside your other one, then set it up with your filesystem of choice. Hard disks are comparatively cheap.
    Linux user #126863 - see

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    This will work and it is stable.
    However you are adding complexity and hierarchy, also performance will potentially suffer.

    So it depends on the usecase.
    If you want to test/get experience with filesystems: No problem, go ahead.
    If this is on your personal workstation: Your call
    If it is a production server: I wouldnt do it. If there is strong reason to introduce btrfs/xfs, then do it properly by using a partition (or lvm logical volumes)
    You must always face the curtain with a bow.

  4. $spacer_open
  5. #4
    Thanks for the replies chaps. Just in case anyone else finds this thread, then note that the underlying file system may put limits on the size of the file you can use for your hosted file system. For example, an underlying ext3 file system with 1kB block sizes limits file sizes to 16GB, which will be the maximum size for the hosted file system you can then create.
    Last edited by boodle; 02-15-2013 at 09:54 AM.

Posting Permissions

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