Il Wednesday 12 December 2007 16:29:05 Kyle McDonald ha scritto:
> [EMAIL PROTECTED] wrote:
> >> #!/usr/bin/bash
> >> mkdir $2
> >> lofiadm -a $1 /dev/lofi/1
> >> mount -F hsfs -o ro /dev/lofi/1 $2 && echo -e "\n\t I have
> >> mounted $1 under the folder $2\n\n"
> >
> > You should realize that "lofiadm" actually outputs the device
> > used, so the script can be written so as not to require only
> > /dev/lofi/1
> >
> > I've attached my scripts which I use for mounting/unmounting lofi
> > volumes.
> >
> > It detects pcfs, ufs and hsfs filesystem and mounts them; it
> > remembers the mount and a single "lofiumount" without arguments
> > will unmount all you mounted.
> >
> > I've written these a long time ago, shortly after lofiadm was
> > added, I think.
> >
> > Usage is simple:
> >
> >     lofimount file.iso /mnt
> >
> >     lofiumount /mnt
> >
> >     lofimount file.ufs /mnt
> >
> > etc.
>
> That's cool Casper.
>
> I know it needs polishing, but I've attached a script I wrote and
> placed in /usr/lib/fs/lofi/mount, so that I could put entries like 
> this in /etc/vfstab:
>

I have a similar (but worse) problem: in linux I need to mount the
individual slices from an image file, thus I need to find the
offsets of the slices.
Unfortunately linux's fdisk can't recognize Sun's slices, but the 
kernel can (from raw partitions of course).

According to a file in the linux kernel sources the structure is this:

struct sun_disklabel {
                unsigned char info[128];   /* Informative text string 
*/
                struct sun_vtoc {
                    __be32 version;     /* Layout version */
                    char   volume[8];   /* Volume name */
                    __be16 nparts;      /* Number of partitions */
                    struct sun_info {           /* Partition hdrs, sec 
2 */
                        __be16 id;
                        __be16 flags;
                    } infos[8];
                    __be16 padding;     /* Alignment padding */
                    __be32 bootinfo[3];  /* Info needed by mboot */
                    __be32 sanity;       /* To verify vtoc sanity */
                    __be32 reserved[10]; /* Free space */
                    __be32 timestamp[8]; /* Partition timestamp */
                } vtoc;
                __be32 write_reinstruct; /* sectors to skip, writes */
                __be32 read_reinstruct;  /* sectors to skip, reads */
                unsigned char spare[148]; /* Padding */
                __be16 rspeed;     /* Disk rotational speed */
                __be16 pcylcount;  /* Physical cylinder count */
                __be16 sparecyl;   /* extra sects per cylinder */
                __be16 obs1;       /* gap1 */
                __be16 obs2;       /* gap2 */
                __be16 ilfact;     /* Interleave factor */
                __be16 ncyl;       /* Data cylinder count */
                __be16 nacyl;      /* Alt. cylinder count */
                __be16 ntrks;      /* Tracks per cylinder */
                __be16 nsect;      /* Sectors per track */
                __be16 obs3;       /* bhead - Label head offset */
                __be16 obs4;       /* ppart - Physical Partition */
                struct sun_partition {
                        __be32 start_cylinder;
                        __be32 num_sectors;
                } partitions[8];
                __be16 magic;      /* Magic number */
                __be16 csum;       /* Label xor'd checksum */
        } * label;


I guess that the partitions[8] identifies the slices, correct?
(did I dream that they were 16? )
Please, correct me if Iìm wrong.

Thanks,
        Nico
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to