Operating System - HP-UX
1819794 Members
3541 Online
109607 Solutions
New Discussion юеВ

How to mount a filesystem in a file

 
Stephen Keane
Honored Contributor

How to mount a filesystem in a file

I can create an HFS filesystem within a file fine, no problems. But how do I then mount the filesystem?

mount -F hfs /file /mountpoint

keeps coming up with:
/file is an invalid operand

I've tried

mount -F lofs /file /mountpoint

same result.

If HP-UX allows you to create a filesystem within a file (using the -d flag) why doesn't it document how to mount the thing!
17 REPLIES 17
Pete Randall
Outstanding Contributor

Re: How to mount a filesystem in a file

Stephen,

I'm still struggling conceptually with creating a file system within a file. Sounds like the chicken and the egg and which one comes first to me.

What command and syntax did you use to do this?


Pete

Pete
Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

e.g. to create a HFS file system of size 12MBytes in a file called fred.

# mkfs -F hfs -d -L $HOME/fred 12288 16 8 4096 1024 32 0 8 4216

You can check the file has a filesystem in it by asking how the filesystem was created:

# mkfs -F hfs -m $HOME/fred

which reports:

# mkfs -F hfs -L $HOME/fred 12288 16 8 4096 1024 32 0 8 4216

All well and good, but the filesystem is particularly useless if I can't access it! The only way I can access it so far is to dd it into a ramdisk (unsupported by HP) and mount the ramdisk. Unfortunately I seem to have hit a size limitation of 2MBytes on a ramdisk (possibly a kernel limit) which I am also investigating.

Why have HP given us the -d facility of mkfs without any obvious way of using the file system you've created?
Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

You can also fsck it, although it does throw up a prompt stating that the file is not special file, continue anyway (or words to that effect).

So mkfs supports it, fsck supports it. How do you mount it !!!!
Robert-Jan Goossens_1
Honored Contributor

Re: How to mount a filesystem in a file

Hi Steven,

I found the options you used in the mkfs_hfs man page. Could you please explain what your goal is ?

Best regards,
Robert-Jan
Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

Goal:

To create a minimal file system, that together with a minimal kernel will allow a HP server to be booted from a tape device.

--- PLEASE DO NOT MENTION IGNITE AT THIS STAGE, I KNOW ABOUT IGNITE ---

I have already achieved this in SunOS and Linux. HP is the difficult one.

If I can create a filesystem within a file and successfully mount it, then I can copy the requisite files into it, unmount it and dd it onto a bootable tape or CD. An alternative approach is to use a ramdisk, but these aren't officially supported by HP.
Dietmar Konermann
Honored Contributor

Re: How to mount a filesystem in a file

HP-UX cannot mount a fs from a regular file. The lofs file system does not support that, sorry.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Cheryl Griffin
Honored Contributor

Re: How to mount a filesystem in a file

The only time I have seen the -d option used was to recreate a filesystem to obtain superblocks locations when the /etc/sbtab was lost.
"Downtime is a Crime."
Dietmar Konermann
Honored Contributor

Re: How to mount a filesystem in a file

Stephen,

just saw your last comment. Why don't you simply create an temporary lvol, create a file system in it, mount it. Then copy whatever you want to it. After that umount it, and copy its contents via dd(1) to a file. Essentially this is what I do, when I fiddle around with Ignite INSTALLFS file systems.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Ralph Grothe
Honored Contributor

Re: How to mount a filesystem in a file

Why doesn't HP-UX yet support mounting of loopback filesystems?
This is common fair on Linux, the free BSDs, and Solaris.

Linux uses either the losetup command to connect a file to a device
(Solaris has the lofiadm command to this end)
After having bound the file to a device you mount it as usual.
In Linux you can straightforward use the mount option "-o loop=/dev/loop?" and it automagically loads the loop or cryptoloop module.

How about putting this feature on the agenda for future HP-UX releases?
Madness, thy name is system administration
Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

Dietmar,

yes that is an option, but I won't necessarily have any free/spare disk space to create a temporary logical volume on. I would like to make use of filesystem or memory space instead, hence the filesystem in a file or ramdisk approaches.
Dietmar Konermann
Honored Contributor

Re: How to mount a filesystem in a file

As I already said... mounting from a file is no option (and I think - although I'm not from marketing, though not officially speaking for HP - that it will be hard to find a true business case that justifies any implementation effords).

How to use a ramdisk... you should be able to find hints here in the forum. The topic has been discussed quite often (although not being supported either).

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Ralph Grothe
Honored Contributor

Re: How to mount a filesystem in a file

Dietmar,

apart from testing ISO images before you waste any media the loopfs can be used for crypto filesystems (e.g. hard disk data on a laptop, or carry-round-items like USB sticks).
On Linux it also serves handily for preparing an initial ramdisk (initrd),
something that is required if you want your root disks be mirrored on raidtool devices with lvm volumes on top.
Preparing this or a recovery CD is a bit tricky.
So it helps a lot to be able to mount a file filesystem.
These seem sufficient reasons to me to justify its implementation.
Madness, thy name is system administration
Zinky
Honored Contributor

Re: How to mount a filesystem in a file

Perhaps another RFE/RFC to the HP-UX engineers?

I use loopback and pseudo filesystems a lot. Like I create ISO images of all my CD's so I can loopback mount on them and share them out and volia! A Virtual CD JukeBox!

I agree with the importance to have a filesystem on a file that is mountable for testing, prototypin, etc..
Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
Dietmar Konermann
Honored Contributor

Re: How to mount a filesystem in a file

Enhancement Request ID is JAGaf42256, if one needs a reference when talking to a local response center.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Zinky
Honored Contributor

Re: How to mount a filesystem in a file

Dietmar - thanks for the info that it is on the pipeline at least..

BTW, will we finally have full Joliet (Microsoft) support at leat on the ISO mounts? I sometimes have a requirement to share Microsoft Joliet -- (Long file names) CDROMs from UNIX and I always ending up using Linux or Solaris...


Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

Hmm, guess I'll have to do it the hard way then! Pointless having the -d flag for mkfs then really.

Easy way:

mkfs filesystem into file.
mount file as filesytem.
... do stuff ...
umount filesystem
dd file on to tape/CD

HP way:

have disk with spare capacity in the first place.

vgcreate (possibly)
lvcreate
mkfs
mount
... do stuff ..
umount filesystem
dd file on to tape/CD
lvremove
vgremove

Stephen Keane
Honored Contributor

Re: How to mount a filesystem in a file

Not supported (yet) thread closed