Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Jul 2014, 16:50
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
guess_fstype reports unknown for Puppy SFS files. [ No Fix ]
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Sat 16 Mar 2013, 21:21    Post subject:  guess_fstype reports unknown for Puppy SFS files. [ No Fix ]  

I was looking for a new version of guess_fstype hoping to fix the problem.
Strangely I can`t seem to find it anywhere. Not SourceForge... Nowhere.

My problem is it reports "unknown" for the newer Puppy SFS files.
I could swear it use to work with the old SFS files.
I noticed that was upgraded to id ext4, so how about a fix for this problem?

I can use "file /Path/SquashFile" to detect files, but partitions still need guess_fstype.
"file" only reports "block" for partitions.
Code:
   fsType=`file $PF |tr [S] [s] |egrep -o '(squashfs|ext2|ext3|ext4)'`      # image file
   [ "$fsType" = "" ]&&                                                                  # partition
      fsType$ =`guess_fstype $PF |egrep -o '(ext2|ext3|ext4|swap|ntfs|vfat)'`


### It would obviously be nice to not have to test twice for partitions.

Is there a fix for this? Or a better way to detect partitions and image files in one command?

Last edited by sunburnt on Wed 03 Apr 2013, 18:27; edited 1 time in total
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sun 17 Mar 2013, 11:03    Post subject:  

Hey Sunburnt,

You can get the source code for "guess_fstype" below mentioned in Barry's blog.
http://bkhome.org/blog2/?viewDetailed=00127

Happy St.Patricks day,
s
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Sun 17 Mar 2013, 14:56    Post subject:  

Hi seaside; Good to hear from you again.

I tried to download it, but it`s passworded so I didn`t get it.

I saw some of the ext4 fix code for it and it looked like C.
So I doubt that I`m able to do much with it.

If it`s written in Bacon and the source code`s available, I could work with that.

Most likely everyone will have to continue to use code like I posted above.

# I`m going to submit a bug report and see what happens.
.
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: Sun 17 Mar 2013, 15:39    Post subject:  

u: puppy
p:linux
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Mon 18 Mar 2013, 03:57    Post subject:  

Thanks pemasu; It is C of course, so as far as fixing it I`m hobbled.

Maybe Barry or technosaurus will address the problem.
Back to top
View user's profile Send private message 
Semme

Joined: 07 Aug 2011
Posts: 3557
Location: World_Hub

PostPosted: Mon 18 Mar 2013, 05:42    Post subject:  

Among others, *disktype* identifies squashfs.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Mon 18 Mar 2013, 17:21    Post subject:  

Semme; Yep, I`m going to eliminate guess_fstype.

I`m looking at several alternatives, disktype looks good.

Thanks for the help! ... Terry
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3953
Location: Kiel,Germany

PostPosted: Tue 19 Mar 2013, 13:44    Post subject:  

Quote:
My problem is it reports "unknown" for the newer Puppy SFS files.
I could swear it use to work with the old SFS files.

Was thinking of the new xz compression for squashfs .
But
Quote:
bash-3.00# mount -o loop /JUMP-2/pup-430.sfs /mnt/loop
[18516.872500] squashfs: version 4.0 (2009/01/31) Phillip Lougher
bash-3.00# guess_fstype /dev/loop0
unknown
bash-3.00# mount
/dev/loop0 on /mnt/loop type squashfs (ro,relatime)

guess_fstype did not work on Puppy 4.3 with normal gz squash .

As far as i understand guess_fstype it is broken out of the mount(-utils) package which inludes that code as an internal function . mount-FULL guesses fstype also and in over 90% in my cases it is not necessary to specify -t whateverfs . Probably a new steal would eliminate any need for patches for the Puppy guess_fstype.
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Tue 19 Mar 2013, 23:06    Post subject:  

Karl; My thought exactly, but I didn`t think the compression should matter.
Apparently my guess was correct, guess_fstype fails at old or new squash files.

In Puppy, mount and umount are scripts by Barry, I think that`s why no file system type is needed.


I`ve settled on this code to do the job in first command. It ids block devices and image files:
Code:
fstype() {
FS=`disktype  $1 |tr [A-Z] [a-z] |egrep -o '(ext2|ext3|ext4|squashfs|ntfs|fat|msdos)'

[ ! "$FS" ]&& echo -e "\n###  ERROR:  Unknown file system type.\n" && exit 1

[ -f $1 ]&& Loop='-o loop '      # if file, then use loop device

case $FS in
   squashfs) FS = "squashfs -r $Loop" ;;
   fat) FS="vfat -w $Loop" ;;
   *) FS="$FS -w $Loop" ;;
esac
}

D_F=(/dev/BlockDevice or /path/ImageFile)
fs=`fstype $D_F`
[ $? -gt 0 ]&& exit

mount -t $fs $D_F MntPt$

Now watch. Technosaurus will do it all in one awk statement...
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3953
Location: Kiel,Germany

PostPosted: Wed 20 Mar 2013, 11:39    Post subject:  

and what about .iso ?

grep -iE '..|iso9660|udf'


example of a confusing disktype output:

Quote:
bash-3.00# disktype /mnt/sda2/PUPPY-ISOs/FATDOG/Fatdog64-611-firefox.iso

--- /mnt/sda2/PUPPY-ISOs/FATDOG/Fatdog64-611-firefox.iso
Regular file, size 203 MiB (212860928 bytes)
DOS/MBR partition map
Partition 1: 203.0 MiB (212856832 bytes, 415736 sectors from 8, bootable)
Type 0x17 (Hidden HPFS/NTFS)
FAT16 file system (hints score 4 of 5)
Volume size 479.8 MiB (503119872 bytes, 7677 clusters of 64 KiB)
Volume name "ISOHYBRID"
ISO9660 file system
Volume name "CDROM"
Application "GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE (C) 1997-2006 J.PEARSON/J.SCHILLING (C) 2006-2007 CDRKIT TEAM"
Data size 202.6 MiB (212469760 bytes, 103745 blocks of 2 KiB)
El Torito boot record, catalog at 34
Bootable non-emulated image, starts at 35, preloads 2 KiB
Platform 0x00 (x86), System Type 0x00 (Empty)
ISOLINUX boot loader
Joliet extension, volume name "CDROM"


Same problem i have with udf showing iso9660 first and below udf .
I use
Code:
| grep -i 'file system' | tail -n1|pipe |further
Back to top
View user's profile Send private message Visit poster's website 
jamesbond

Joined: 26 Feb 2007
Posts: 2044
Location: The Blue Marble

PostPosted: Wed 20 Mar 2013, 15:24    Post subject:  

I used disktype in early Fatdog64 600 releases. It worked okay on my machines, but if I remember correctly there were a few feedbacks that it was rather slow on certain combination. On all of my machines, both worked equally fast, but of course YMMV.

Anyway, here is a patch for enabling squashfs detection. It works regardless of the compression types. I created the patch on guess_fs-20120911 - this version of guess_fstype isn't the latest (the latest guess_fstype from Barry's site is the one that has f2fs detection), but it is recent enough. The only caveat: The patch also contains modification for compilation with musl; so if you don't have musl and/or want to compile with dietc then you have to hack the Makefile yourself. As for whether the patch works - well, recent releases of Fatdog64 has this in it Smile Compiles in both 32-bit and 64-bit systems (but not tested on ARM).

Karl Godt, disktype output of "ISO/UDF" is correct. Any ISO that also has an UDF filesystem will always be detected as iso9660 first, and then udf second. A pure-UDF filesystem (the one you do by running mkudffs) will not have any iso9660 stuff, but it cannot also be correctly described as an ISO file.

As for Fatdog64 iso (that of 610-series), it is an isohybrid which means that is is a valid ISO, but at the same time it also has a partition table to make it look like a disk image that can be flashed directly to an USB flash drive. I think amigo just made a timely related post here: http://murga-linux.com/puppy/viewtopic.php?p=693279#693279 (read the isohybrid part).
guess_fs-20120911-james.patch.gz
Description  Contains real gzipped data, so gunzip first before use.
gz

 Download 
Filename  guess_fs-20120911-james.patch.gz 
Filesize  2.15 KB 
Downloaded  88 Time(s) 

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3953
Location: Kiel,Germany

PostPosted: Wed 20 Mar 2013, 19:52    Post subject:    

Excellent, James ! Have applied it on http://murga-linux.com/puppy/viewtopic.php?p=651646#651646 the source ball by technosaurus with btrfs support and works fine :

/dev/loop0 on /mnt/luci-218.sfs.16570 type squashfs (ro,relatime)
./guess_fstype /dev/loop0
squashfs
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Thu 21 Mar 2013, 17:06    Post subject:  

Thanks jamesbond; Why doesn`t Barry`s new version have fixed squashfs?
Anyway, guess_fstype is Puppy specific and not in other mainstream Linux distros.

Karl; I see what you mean, my intentions for this code was mounting for app. development.
But iso is important enough, and the code could be used generally also.
I assume udf is a format inside the iso9660 wrapper?

# Wouldn`t it be nice if ALL "bash" commands had an option to output only data, no trash?


My intent is an app. to add a temp. top write layer to Puppy`s aufs layers ( a dir. ).
So installed Apps. are isolated from Puppy`s save file and can be developed normally.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3953
Location: Kiel,Germany

PostPosted: Thu 21 Mar 2013, 17:18    Post subject:  

You mean something like forcing PUPMODE=13 on USB-Flash on frugal HDD installations PUPMODE=12 ?
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Thu 21 Mar 2013, 20:05    Post subject:  

I don`t know the pup-modes, I do know flash-mode does a timed save.

Thinking a new top union layer in Puppy`s aufs, or a fuse-union on top of aufs /.
So aufs = mainSFS | saveSFS on / , and then fuse = dir. on / .

I like the idea of using fuse as it`s easy to setup for most distros.
And it`s only for app. development, not a permanent part of the O.S.

Last edited by sunburnt on Fri 22 Mar 2013, 01:29; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0863s ][ Queries: 13 (0.0054s) ][ GZIP on ]