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 Mon 28 Jul 2014, 04:43
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
partition informations - running some tests
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Wed 23 Jan 2008, 22:02    Post subject:  partition informations - running some tests  

can you help me?
I need some people (5 should be enough at moment) who do this:
please type:

cat /proc/diskstats >/root/mark-help.txt
probepart >> /root/mark-help.txt
gzip /root/mark-help.txt


Then please attach /root/mark-help.txt.gz here.


I'm doing some tests to find out a fast way to get drive-infos.
probepart is a bit slow, if you have many partitions.

I wrote a testcript, that gives me this result:
Quote:
# ./finddisks
hda1 not mounted
hda2 not mounted
hda5 not mounted
hda6 not mounted
hdb mounted maybe a cdrom
sda1 not mounted
sda2 mounted
sda3 not mounted
sda4 not mounted
sda5 not mounted
sda6 not mounted
sda7 mounted
sda8 not mounted
sda9 not mounted
sda10 not mounted
sda11 not mounted
sda12 not mounted
sda13 not mounted
sda14 not mounted
sda15 mounted
swap: /dev/sda15 partition 522072 6132 -1


I'd like to find out more info, but don't know yet, how.
Must study the other utilities like MUT.

Mark

finddisks
Code:
#!/usr/bin/puppybasic
include "/usr/lib/wxbasicscript/basefunctions.inc"

//thelist=xwin_system("cat /proc/diskstats")


//   3   64 hdb 0 0 0 0 0 0 0 0 0 0 0


thelist=readfiletolist("/proc/diskstats")

//print thelist

partitions = {}
counter = 0
for each theline in thelist

  theline=trim(theline)
  for n=0 to 5
     theline=replace(theline , "  " , " ")
  next
  partinfo=explode(theline , " ")
 
  entries=count(partinfo)
  //print partinfo[2] & " " & entries

  if entries = 7 then
        mounted = "mounted"
   if partinfo[5] = "0" then
      mounted = "not mounted"
   end if
   print partinfo[2] & " " & mounted
  end if
  if  val(partinfo[1])>63 then
        mounted = "mounted"
   if partinfo[5] = "0" then
      mounted = "not mounted"
   end if
   print partinfo[2] & " " & mounted & " " & "maybe a cdrom"
  end if

next

swaps=readfiletolist("/proc/swaps")
for n=1 to count( swaps )-1
   print "swap: " & swaps[n]
next

Back to top
View user's profile Send private message Visit poster's website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 23 Jan 2008, 22:23    Post subject: lob help  

lobhelp attached
lobhelp.tar.gz
Description 
gz

 Download 
Filename  lobhelp.tar.gz 
Filesize  459 Bytes 
Downloaded  301 Time(s) 

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
NathanO

Joined: 22 Feb 2007
Posts: 196
Location: San Antonio, TX

PostPosted: Wed 23 Jan 2008, 22:27    Post subject:  

I have two computers. Here is the first, an HP Pavilion zv6000 with a CD/DVD, 80Gig HD, two 8Gig USB sticks.
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  390 Bytes 
Downloaded  287 Time(s) 
Back to top
View user's profile Send private message 
NathanO

Joined: 22 Feb 2007
Posts: 196
Location: San Antonio, TX

PostPosted: Wed 23 Jan 2008, 22:30    Post subject:  

Here is the other, home made, 3-1/2" floppy, ~40 Gig HD, TWO CD/DVD player / burners, 2 PCMCIA Flash Cards, 4 Gig USB stick
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  452 Bytes 
Downloaded  310 Time(s) 
Back to top
View user's profile Send private message 
John Doe

Joined: 01 Aug 2005
Posts: 1689
Location: Michigan, US

PostPosted: Wed 23 Jan 2008, 22:49    Post subject:  

Here you go Mark. Machine has two CD Drives, a Floppy Drive and two usb flash drives plugged in. No internal IDE in this one.
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  334 Bytes 
Downloaded  295 Time(s) 
Back to top
View user's profile Send private message 
oldbox

Joined: 18 Dec 2007
Posts: 10

PostPosted: Wed 23 Jan 2008, 23:44    Post subject:  

I had a sony tiny microvault plugged into an external usb hub at the time of the commands.

Hope this helps you.
oldbox-help.txt.gz
Description 
gz

 Download 
Filename  oldbox-help.txt.gz 
Filesize  405 Bytes 
Downloaded  272 Time(s) 
Back to top
View user's profile Send private message 
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Thu 24 Jan 2008, 00:00    Post subject:  

.
Here we go Mark -

ASROCK VIA M/B; AMD Duron 1.8GHz CPU; 1.0GB DDR RAM; 20 GB HDD; 80GB HDD; 1 x 1.0GB USB Flash drive; 1 x 2.0GB USB Flash drive; DVD/CD Burner/Reader; Floppy drive..

HTH..

crafty.
.
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  477 Bytes 
Downloaded  293 Time(s) 

_________________
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..
Back to top
View user's profile Send private message 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Thu 24 Jan 2008, 03:26    Post subject:  

hda = dvd-rw
sda = 80-gig SATA drive
sdb = 128 mb usb flash drive


Code:
sh-3.00# ./finddisks
sda1 not mounted
sda2 not mounted
sda3 not mounted
sda4 mounted
sda5 mounted
sda6 mounted
sda7 mounted
sdb1 mounted
swap: /initrd/dev/sda2                        partition 498004  0       -1
sh-3.00#


Except sdb1 is not mounted anymore. It was not very long ago. Otherwise all looks correct.

Running Puppy 2.14 if it matters.
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  581 Bytes 
Downloaded  303 Time(s) 

_________________
Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 24 Jan 2008, 05:00    Post subject:  

Many thanks, I'll have a look at your files this weekend.
Today I must travel to northern germany.

Here is another code-example.

Using fdisk -l is the fastest you can have.
It does does not show the difference ext2/ext3, it just says "Linux".
So we might need blkid.
Also fdisk does not show CDRoms.
As blkid is slower, I will try to find other ways.
Maybe using /proc again for infos about CDROMS.
For this your files will be helpfull, to see what special identifier those CDROM-drives use.

See you, Mark
Code:
#!/usr/bin/puppybasic
include "/usr/lib/wxbasicscript/basefunctions.inc"

//thelist=xwin_system("cat /proc/diskstats")
//   3   64 hdb 0 0 0 0 0 0 0 0 0 0 0


names={}
types={}
ismounted={}

try1()


sub try1()

counter=0
blockids=xwin_system("blkid -s TYPE")
thelist=readfiletolist("/proc/diskstats")


for each theline in thelist

  theline=trim(theline)
  for n=0 to 5
     theline=replace(theline , "  " , " ")
  next

  partinfo=explode(theline , " ")
  entries=count(partinfo)

  use = 0
  if entries = 7 then
   use = 1
  end if
  if  val(partinfo[1])>63 then
   use = 1
  end if

  if use = 1 then
        mounted = "mounted"
   if partinfo[5] = "0" then
      mounted = "unmounted"
   end if
   filesystem = "unknown"
   for each block in blockids
      type=cutleft(block , "TYPE=")
      block=cutright(block , ":")
      block=cutleft(block , "/dev/")
      if block = partinfo[2] then
         filesystem=replace(type , "\"" , "")
         filesystem=trim(filesystem)
         break
      end if
   next

   if filesystem != "unknown" then

      names[counter] = partinfo[2]
      types[counter] = filesystem
      ismounted[counter] = mounted
      counter += 1
      print partinfo[2] & " " & filesystem &  " " & mounted
   end if
  end if

next

'swaps=readfiletolist("/proc/swaps")
'for n=1 to count( swaps )-1
'   print "swap: " & swaps[n]
'next

end sub

thelist=xwin_system("fdisk -l")

for each theline in thelist

   if left(theline , 5) = "/dev/" then
      if ! instr(theline , "Extended") then
           theline = trim(theline)

         name=cutrightfromleft(theline , " ")
         name=right(name, len(name)-5)
         for n = 0 to count(names)-1

            if name=names[n] then
               size=cutleft(theline , " ")
               size=trim(size)
               size=cutleft(size , " ")
               size=trim(size)
               size=cutleft(size , " ")
               size=trim(size)
               size=cutrightfromleft(size , " ")
               size=replace(size , "+" , "")
               print name & " " & types[n] & " " & size & " " & ismounted[n]
               break
            end if
         next
         //print theline
      end if
   end if

next

Back to top
View user's profile Send private message Visit poster's website 
Leachim

Joined: 27 May 2007
Posts: 229

PostPosted: Thu 24 Jan 2008, 11:21    Post subject:  

From one of our school computers. Running from usb-flash-drive. Windows XP on the builtin hdd.
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  409 Bytes 
Downloaded  307 Time(s) 
Back to top
View user's profile Send private message 
JustGreg

Joined: 24 May 2005
Posts: 666
Location: Connecticut USA

PostPosted: Thu 24 Jan 2008, 20:27    Post subject:
Subject description: Some more data for you
 

Here is the information from my system running a 80 Gigabyte drive,
1 Gigabyte USB external hard drive, 1 Gigabyte compact flash device and 2 Gigabyte SD card in the USB mult-card reader.
mark_tst.txt.gz
Description 
gz

 Download 
Filename  mark_tst.txt.gz 
Filesize  601 Bytes 
Downloaded  284 Time(s) 

_________________
Enjoy life, Just Greg
Live Well, Laugh Often, Love Much
Back to top
View user's profile Send private message 
Billwho?


Joined: 06 Dec 2005
Posts: 570
Location: still "In The Dog House" East Coast Oz Trialing 4.20

PostPosted: Sat 26 Jan 2008, 06:03    Post subject:  

Here is the information for 3 machines I have here. One is incomplete but I hope it helps anyway.
finddisks.tar.gz
Description 
gz

 Download 
Filename  finddisks.tar.gz 
Filesize  3.16 KB 
Downloaded  268 Time(s) 

_________________
Linux = Learning through doing Shocked Confused Very Happy
The learning curve may be steep but there is a light at the end of the tunnel.
You just have to pass the occasional oncoming train to get there.
Back to top
View user's profile Send private message 
r__hughes

Joined: 13 Apr 2006
Posts: 342
Location: Canada

PostPosted: Sun 27 Jan 2008, 20:05    Post subject:  

This from an IBM T22 Thinkpad
mark-help.txt.gz
Description 
gz

 Download 
Filename  mark-help.txt.gz 
Filesize  344 Bytes 
Downloaded  290 Time(s) 

_________________
--- quad booting pup431, Slacko55PAE, Slacko56NPAE (with OO3/LO4, devx, Gimp) & WXP on DELL Dimension 2400 PC & DELL Latitude 630 Laptop using grub.
---USB-Flash booting same on Samsung N110 WXP Netbook and Lenovo q100 WXP netPC.
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 27 Jun 2008, 12:52    Post subject:  

I updated my script.
It gave wrong values on one computer:
Code:
/dev/sda1   *           1        1216     9765625    b  W95 FAT32

the "*" bootflag now is filtered out.

It also no longer uses /proc/ to find out, if a drive was mounted, but /etc/mtab.
The code got shorter now.
Another issue was, that Extended partitions were no detected (excluded) correctly.
Only the second line in this "fdisk -l" output was detected:

Code:
/dev/hda2             679        1559     6660360    f  W95 Ext'd (LBA)
/dev/sda4            3648       24316   166015625    5  Extended

This is corrected now.
Mark

finddisks
Code:
#!/usr/bin/puppybasic
include "/usr/lib/wxbasicscript/basefunctions.inc"

'shell("sync")

blockids=xwin_system("blkid -s TYPE")

'swaps=readfiletolist("/proc/swaps")
'for n=1 to count( swaps )-1
'   print "swap: " & swaps[n]
'next

thelist=xwin_system("fdisk -l")

mtab=readfiletolist("/etc/mtab")

for each theline in thelist

   if left(theline , 5) = "/dev/" then
      if ! instr(theline , "Ext") then
         theline = replace(theline , "*" , "")
         theline = trim(theline)
         name=cutrightfromleft(theline , " ")
         device = name
         name=right(name, len(name)-5)

         size=cutleft(theline , " ")
         size=trim(size)
         size=cutleft(size , " ")
         size=trim(size)
         size=cutleft(size , " ")
         size=trim(size)
         size=cutrightfromleft(size , " ")
         size=replace(size , "+" , "")

         mountedmtab = "unmounted"
         for m=0 to count(mtab)-1
            if instr(mtab[m] , " ") then
               thedev = cutrightfromleft(mtab[m] , " ")
               if thedev = device then
                  mountedmtab = "mounted"   
                  break
               end if
            end if
         next

         filesystem = "unknown"
           for each block in blockids
              type=cutleft(block , "TYPE=")
              block=cutright(block , ":")
              if block = device then
                    filesystem=replace(type , "\"" , "")
                    filesystem=trim(filesystem)
                    break
                  end if
         next

      '-- too slow...
      'result = xwin_system("disktype " & device )
      'dsize = "unknown"
      'for d=0 to count(result)
      '   if instr(result[d] , "size " ) then
      '      dsize = cutleft(result[d] , "(")
      '      dsize = cutright(dsize , ")")
      '   end if
      'next


         if command(3) = "-m" then
            size = int(size/1000)
         end if

         print name & " " & filesystem & " " & size & " " & mountedmtab

      end if
   end if

next


Here is an example output:
Code:
# ./finddisks -m
hda1 vfat 5125 unmounted
hda5 ext3 5738 mounted
hda6 swap 839 unmounted
sda1 vfat 9765 unmounted
sda2 ext2 9765 mounted
sda3 ext2 9765 mounted
sda5 ext2 97 unmounted
sda6 ext2 48730 unmounted
sda7 vfat 48828 unmounted
sda8 ext2 9765 unmounted
sda9 ext2 9765 mounted
sda10 ext2 9765 unmounted
sda11 ext2 9765 unmounted
sda12 ext2 9765 unmounted
sda13 ext2 9765 unmounted
sda14 vfat 9237 unmounted
sda15 swap 522 unmounted


The swappartitions are shown as "unmounted", what is wrong.
I must add a fix for that.

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Mon 30 Jun 2008, 15:56    Post subject:  

updated code.

run with option "-all" to show cdroms (they start with "-").
DVDs not yet added.
This was just tested on 1 machine, so might not work reliable.
It is optional, because cdrom-detection is slow.

Also swap now is displayed as on or off.

And or mounted drives, the mountpoint is displayed.

Code:
#!/usr/bin/puppybasic
include "/usr/lib/wxbasicscript/basefunctions.inc"

'shell("sync")

' cdrom:
'probedisk

args = argvtostring()

args = " " & args & " "
blockids=xwin_system("blkid -s TYPE")

'swaps=readfiletolist("/proc/swaps")
'for n=1 to count( swaps )-1
'   print "swap: " & swaps[n]
'next

thelist=xwin_system("fdisk -l")

mtab = readfiletolist("/etc/mtab")

swaps = readfiletolist("/proc/swaps")

for each theline in thelist

   if left(theline , 5) = "/dev/" then
      if ! instr(theline , "Ext") then
         theline = replace(theline , "*" , "")
         theline = trim(theline)
         name=cutrightfromleft(theline , " ")
         device = name
         name=right(name, len(name)-5)

         size=cutleft(theline , " ")
         size=trim(size)
         size=cutleft(size , " ")
         size=trim(size)
         size=cutleft(size , " ")
         size=trim(size)
         size=cutrightfromleft(size , " ")
         size=replace(size , "+" , "")

         mountedmtab = "unmounted"
         for m=0 to count(mtab)-1
            if instr(mtab[m] , " ") then
               thedev = cutrightfromleft(mtab[m] , " ")
               if thedev = device then
                  mountpoint = cutleft(mtab[m] , " ")
                  mountpoint = cutrightfromleft(mountpoint , " ")
                  'mountedmtab = "mounted"   
                  mountedmtab = mountpoint
                  break
               end if
            end if
         next

         filesystem = "unknown"
           for each block in blockids
              type=cutleft(block , "TYPE=")
              block=cutright(block , ":")
              if block = device then
                    filesystem=replace(type , "\"" , "")
                    filesystem=trim(filesystem)
                    break
                  end if
         next

         if filesystem = "swap" then
            mountedmtab = "off"
            for each swap in swaps
               if instr(swap , " ") then
                  theswap = cutrightfromleft(swap , " ")
                  if theswap = device then
                     mountedmtab = "on"   
                     break
                  end if
               end if
            next
         end if

      '-- too slow...
      'result = xwin_system("disktype " & device )
      'dsize = "unknown"
      'for d=0 to count(result)
      '   if instr(result[d] , "size " ) then
      '      dsize = cutleft(result[d] , "(")
      '      dsize = cutright(dsize , ")")
      '   end if
      'next


         if instr(args, " -m ") then
            size = int(size/1000)
         end if

         print name & " " & filesystem & " " & size & " " & mountedmtab

      end if
   end if

next

'print
'print

if instr(args, " -all ") then
   drives = xwin_system("probedisk")
   for each drive in drives
      if instr(drive , "|") then
         device = cutrightfromleft(drive , "|")
         drive = trim(replace(drive , "/dev/" , ""))
         typ = cutleft(drive , "|")
         drive = replace(drive , "|" , " ")
         if instr(typ , "|") then
            typ = cutright(typ , "|")

            select case typ
               case "cdrom"
               m = ismounted(device)
               print "-" & drive & " " & m
            end select

         end if
      end if
      'print drive
   next
end if

function ismounted(device)
         mounted = "unmounted"
         for m=0 to count(mtab)-1
            if instr(mtab[m] , " ") then
               thedev = cutrightfromleft(mtab[m] , " ")
               if thedev = device then
                  mountpoint = cutleft(mtab[m] , " ")
                  mountpoint = cutrightfromleft(mountpoint , " ")
                  'mountedmtab = "mounted"   
                  mountedmtab = mountpoint
               end if
            end if
         next
         return mounted

end function


Example-Output:
Quote:
# ./finddisks -m -all
hda1 vfat 5125 unmounted
hda5 ext3 5738 /initrd/mnt/dev_save
hda6 swap 839 on
sda1 vfat 9765 unmounted
sda2 ext2 9765 /mnt/sda2
sda3 ext2 9765 /mnt/sda3
sda5 ext2 97 unmounted
sda6 ext2 48730 unmounted
sda7 vfat 48828 unmounted
sda8 ext2 9765 unmounted
sda9 ext2 9765 /mnt/sda9
sda10 ext2 9765 unmounted
sda11 ext2 9765 unmounted
sda12 ext2 9765 unmounted
sda13 ext2 9765 unmounted
sda14 vfat 9237 unmounted
sda15 swap 522 off
-hdc cdrom MATSHITADVD-ROM SR-8174 unmounted


Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.1551s ][ Queries: 12 (0.0128s) ][ GZIP on ]