4

I have a file 100gb in size and a server with two 72gb disk's.

The server runs Ubuntu Linux, with ext4 on the disks, and without LVM.

How I can put the 100gb file on the server with 72+72gb disk's?

I can't change the filesystem and I can't split the file; the file must be readable.

5

You could create two ~50GB files, one per disk. Then use losetup to map them to loop devices. You can now combine those two loop devices, e.g., with mdraid raid0. Now you can create a filesystem on that array, and finally put your file there.

This is somewhat convoluted, but, well, the right way to do this would be to use LVM and/or mdraid on your two disks if you want to treat them as one.

Example, with much smaller images (and obviously you'll need to use sane paths here, instead of /tmp like I did. And probably a better array name than "test"):

root@Zia:/tmp# dd if=/dev/zero of=/tmp/img1 bs=1024k count=1024
⋮
root@Zia:/tmp# dd if=/dev/zero of=/tmp/img2 bs=1024k count=1024
⋮
root@Zia:/tmp# losetup --show -f /tmp/img1
/dev/loop0
root@Zia:/tmp# losetup -f /tmp/img2
/dev/loop1
root@Zia:/tmp# mdadm -C /dev/md/test -l 0 -n 2 /dev/loop0 /dev/loop1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/test started.
root@Zia:/tmp# mkfs.ext4 -Tlargefile4 /dev/md/test 
⋮
root@Zia:/tmp# mount /dev/md/test /mnt/tmp
root@Zia:/tmp# df -h /mnt/tmp/
Filesystem      Size  Used Avail Use% Mounted on
/dev/md126      2.0G  3.0M  1.9G   1% /mnt/tmp

And, to put it back together on boot (you'll want to script this, of course):

root@Zia:/tmp# losetup --show -f /tmp/img1 
/dev/loop0
root@Zia:/tmp# losetup --show -f /tmp/img2
/dev/loop1
root@Zia:/tmp# mdadm --assemble /dev/loop0 /dev/loop1
mdadm: device /dev/loop0 exists but is not an md array.
root@Zia:/tmp# mdadm --assemble /dev/md/test /dev/loop0 /dev/loop1
mdadm: /dev/md/test has been started with 2 drives.
root@Zia:/tmp# mount /dev/md/test /mnt/tmp

Tearing it down before reboot/shutdown will probably just work, but you umount it, then mdadm --stop /dev/md/test, then losetup -d on both of the loop devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.