Skip to contentSkip to conversation

File as generic block-device?

DISCUSSION Simen Thoresen 3 participants 5 messages Oct 22, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a project where I require to treat a file as a block-device (specifically, I want a file on an ext3 fs to act as one of the raid-members in a md-based stripe-set. I know that I can make a /filesystem/ on a file because both mkfs and mount (with -o loop) will accept a file as a block-device, but I have found no such function for mdadm, and am thus asking for a kernel-internal way to re-plug a file into the block-device layer.

Is this possible?

My current platform i CentOS5, a RHEL5 rebuild (modified 2.6.18-kernel).

-S

Signature · 1 line
Simen Thoresen - Dolphin ICS Systems Administrator
#1 lore raw
Quoted 8 lines · Simen Thoresen

I have a project where I require to treat a file as a block-device (specifically, I want a file on an ext3 fs to act as one of the raid-members in a md-based stripe-set. I know that I can make a /filesystem/ on a file because both mkfs and mount (with -o loop) will accept a file as a block-device, but I have found no such function for mdadm, and am thus asking for a kernel-internal way to re-plug a file into the block-device layer.

Is this possible?

Sure! You just have to create the loop device (/dev/loop*) yourself using losetup(8). `mount -o loop' does it itself behind your back.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010

#2 lore raw
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Simen Thoresen

I have a project where I require to treat a file as a block-device (specifically, I want a file on an ext3 fs to act as one of the raid-members in a md-based stripe-set. I know that I can make a /filesystem/ on a file because both mkfs and mount (with -o loop) will accept a file as a block-device, but I have found no such function for mdadm, and am thus asking for a kernel-internal way to re-plug a file into the block-device layer.

Quoted 4 lines
Quoted 1 line

Is this possible?

Sure! You just have to create the loop device (/dev/loop*) yourself using losetup(8). `mount -o loop' does it itself behind your back.

Ah! Perfect, thank you.

-S

Quoted 16 lines

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010

Signature · 1 line
Simen Thoresen - Dolphin ICS Systems Administrator
#3 lore raw
In reply to Simen Thoresen

also sprach Simen Thoresen <[email protected]> [2008.10.22.1456 +0200]:

Quoted 3 lines

accept a file as a block-device, but I have found no such function for mdadm, and am thus asking for a kernel-internal way to re-plug a file into the block-device layer.

I suggest you search the web first.
http://en.wikipedia.org/wiki/Loopback_disk_device

Signature · 7 lines
martin | http://madduck.net/ | http://two.sentenc.es/
 
"you don't sew with a fork, so i see no reason
 to eat with knitting needles."
                               -- miss piggy, on eating chinese food
 
spamtraps: [email protected]
#4 lore raw
Quoted 7 lines · martin f krafft

also sprach Simen Thoresen <[email protected]> [2008.10.22.1456 +0200]:

Quoted 3 lines

accept a file as a block-device, but I have found no such function for mdadm, and am thus asking for a kernel-internal way to re-plug a file into the block-device layer.

I suggest you search the web first.
http://en.wikipedia.org/wiki/Loopback_disk_device

Thank you - I missed googling for the absolutely obvious.

Sigh.

-S

Signature · 1 line
Simen Thoresen - Dolphin ICS Systems Administrator