Skip to main content
added 1 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

The idea being to do a linear device-mapper device which is just the concatenation of the two loop devicedevices.

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

Here, we're using the "multi-part" mode of nbd-server that expects the parts to be named as part.0, part.1... Unfortunately, contrary to qemu-nbd, nbd-server/client can't work with Unix domain sockets which mean we have to have the TCP overhead and qemu-nbd doesn't have such a multi-part mode.

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

The idea being to do a linear device-mapper device which is just the concatenation of the two loop device.

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

Here, we're using the "multi-part" mode of nbd-server that expects the parts to be named as part.0, part.1... Unfortunately, contrary to qemu-nbd, nbd-server/client can't work with Unix domain sockets which mean we have to have the TCP overhead and qemu-nbd doesn't have such a multi-part mode.

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

The idea being to do a linear device-mapper device which is just the concatenation of the two loop devices.

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

Here, we're using the "multi-part" mode of nbd-server that expects the parts to be named as part.0, part.1... Unfortunately, contrary to qemu-nbd, nbd-server/client can't work with Unix domain sockets which mean we have to have the TCP overhead and qemu-nbd doesn't have such a multi-part mode.

added 2 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

Using nbd-client + nbd-server

The idea being to do a linear device-mapper device which is just the concatenation of the two loop device.

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

Here, we're using the "multi-part" mode of nbd-server that expects the parts to be named as part.0, part.1... Unfortunately, contrary to qemu-nbd, nbd-server/client can't work with Unix domain sockets which mean we have to have the TCP overhead and qemu-nbd doesn't have such a multi-part mode.

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
$(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

The idea being to do a linear device-mapper device which is just the concatenation of the two loop device.

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)

Here, we're using the "multi-part" mode of nbd-server that expects the parts to be named as part.0, part.1... Unfortunately, contrary to qemu-nbd, nbd-server/client can't work with Unix domain sockets which mean we have to have the TCP overhead and qemu-nbd doesn't have such a multi-part mode.

Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

To answer the second part of your question. How to mount a FS stored in two files (a and b) Two options I can think of:

Using device-mapper and loop devices:

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
$(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF
mount /dev/mapper/merge /mnt

Using nbd-client + nbd-server

ln -s a part.0
ln -s b part.1
nbd-server 127.1@12345 "$PWD/part" -m
nbd-client 127.1 12345 /dev/nbd0
mount /dev/nbd0 /mnt

(easier but less efficient)