How to mount all partitions at bootup?

Using applications, configuring, problems
Message
Author
User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

How to mount all partitions at bootup?

#1 Post by nic007 »

I've remastered and running "live" without using a save file. Tried placing the script: mount -t ntfs /dev/sda5 /mnt/sda5 in local.rc and also tried it in the startup folder. No luck seems to want to mount momentarily but not. Any ideas?
How do I include a slight time delay of say 10 seconds in the script as that may do the trick, I think?

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

Re: Mounting all partitions at bootup running "live session"

#2 Post by CatDude »

Hello nic007
nic007 wrote:..How do I include a slight time delay of say 10 seconds in the script as that may do the trick, I think?
Try this

Code: Select all

sleep 10
CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#3 Post by nic007 »

Thanks, CatDude. That works for normal running of the script but the trick unfortunately does not work at bootup. Greater intervention seems to be the order of the day. Mmm, some more thinking but I'll get there eventually.

Jasper

#4 Post by Jasper »

Hi 007,

Try Startmount from 01micko - download from below then delete the last three (dot g z) characters.

If I understand you correctly and if that doesn't work you could use xdotool in your Startup and say,

Code: Select all

sleep 10
xdotool mousemove xxx xxx 
sleep 0.5
xdotool click 1
Name the file say, "mntsda5" make it executable and exchange xxx xxx for your sda5 desktop icon coordinates. Experiment with "sleep 10" to find a value that suits.

My regards
Attachments
Startmount-0.5.5.pet.gz
(7.98 KiB) Downloaded 157 times

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#5 Post by nic007 »

pass

Jasper

#6 Post by Jasper »

Hi again,

I assume pass means neither of my suggestions work.

Which Pup are you using and can you include a desktop screen shot?

My regards

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#7 Post by nic007 »

Jasper wrote:Hi again,

I assume pass means neither of my suggestions work.

Which Pup are you using and can you include a desktop screen shot?

My regards
Hi, Jasper. Startmount does not work, I've tried it before and get an error that I'm operating in "live" mode. Xdotool works and mounts the partition to be explored but that's not really what I want. I want to mount the partition but not explore it immediately, necessarily (so no window)..

Jasper

#8 Post by Jasper »

Hi,

If using rox - add:

Code: Select all

rox -D /
as the last line of the file.

My regards

Jasper

#9 Post by Jasper »

PS I too am really interested in an ideal solution if anyone can help.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#10 Post by nic007 »

Jasper wrote:PS I too am really interested in an ideal solution if anyone can help.
Are you talking about inserting that as the last line of the script file? If so, not working for me

Jasper

#11 Post by Jasper »

Hi,

Yes, add at the bottom

Code: Select all

sleep 1
rox -D /
My regards

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#12 Post by RSH »

Code: Select all

#!/bin/bash -a
#------------------------------------------------------------------------------
# Full Drive Mounter Backend, Original by W.Schmidt and SFR
# 2013-03-06 RSH for LazY Puppy
#------------------------------------------------------------------------------

# Sort out swap and mounted partitions
blkid  | egrep '(hd|sd)' | egrep -v "/dev/loop*" | egrep -v "swap" | cut -f 1 -d ':' | sed 's/\/dev\///'>/tmp/list_of_drives
sort -u /tmp/list_of_drives > /tmp/sorted_list_of_drives
mv /tmp/sorted_list_of_drives /tmp/list_of_drives
#cp -af /tmp/sorted_list_of_drives /tmp/list_of_drives
#rm -f /tmp/sorted_list_of_drives
for drive in  `cat /tmp/list_of_drives` ; do
   mkdir -p /mnt/$drive
   if [ "`blkid /dev/$drive | grep -o "TYPE=.*" | cut -f2 -d '"'`" = "ntfs" ]; then
     mount -t ntfs /dev/$drive /mnt/$drive
   else
     mount /dev/$drive /mnt/$drive
   fi
   echo $drive
done 
exit 0

#------------------------------------------------------------------------------
# End 
#------------------------------------------------------------------------------
Put it into /root/Startup or create a .desktop file for it and execute it from a Menu Entry.

I'm using this in all of my remastered Operating Systems.

RSH

Edit:

In addition to the Script above, I do use the next Script to unmount all ISO, SFS, 2FS, 3FS and 4FS Files mounted under /mnt.

Code: Select all

#!/bin/bash -a
#------------------------------------------------------------------------------
# Unmount all ISO, SFS, 2FS, 3FS and 4FS Files (used at shutdown)
# 2012-12-28 RSH for LazY Puppy
#------------------------------------------------------------------------------

Path=/mnt
Files=`find $Path -maxdepth 1 -type d`
echo "$Files" |while read F
do
	if [ "$F" != "" ]; then
		# Set to don't unmount $F
		do_unmount="false"
		if [[ "$F" == *\.sfs* ]]; then
			do_unmount="true"
			elif [[ "$F" == *\.SFS* ]]; then
				do_unmount="true"
				elif [[ "$F" == *\.2fs* ]]; then
					do_unmount="true"
					elif [[ "$F" == *\.3fs* ]]; then
						do_unmount="true"
						elif [[ "$F" == *\.4fs* ]]; then
							do_unmount="true"
		fi
		# Unmount if $F is SFS or Save File (do_unmount="true")
		if [ "$do_unmount" = "true" ]; then
			echo $F > /dev/null
			umount $F
			sleep .2
			rox -D $F
			rm -r $F
		fi
	fi
done

Path=/mnt
Files=`find $Path -maxdepth 1 -type d`
echo "$Files" |while read F
do
	if [ "$F" != "" ]; then
		# Set to don't unmount $F
		do_unmount="false"
		# Check for mounted ISO or SFS
		if [[ "$F" == *\.iso* ]]; then
			do_unmount="true"
			elif [[ "$F" == *\.ISO* ]]; then
			do_unmount="true"
		fi
		# Unmount if $F is ISO (do_unmount="true")
		if [ "$do_unmount" = "true" ]; then
			echo $F > /dev/null
			umount $F
			sleep .2
			rox -D $F
			rm -r $F
		fi
	fi
done

exit 0

#------------------------------------------------------------------------------
# End 
#------------------------------------------------------------------------------
Name it: UnMount_all_ISO_files and put it into /usr/sbin.

Code to unmount all Partitions can be found either in /sbin/pup_event_frontend_d (older Pups like Lucid) or in /usr/local/pup_event/frontend_funcs (newer Pups like Precise). Search for function: unmount_drive and use this code to execute it:

Code: Select all

# Unmount all  ISO, SFS, 2FS, 3FS and 4FS
/usr/sbin/UnMount_all_ISO_files
sleep .2
# All loaded/mounted Files should be unmounted now, so try to unmount all drives
for MNTPT in `mount | grep '^/dev/' | grep -vE '^/dev/loop|^/dev/ram' | cut -f 3 -d ' ' | grep -v '^/initrd/' | grep -v '^/$' | tr '\n' ' '`
do
	unmount_drive
done
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#13 Post by nic007 »

Thanks RSH. Just a little follow up - Puppy's welcome message seems to "hold back" the scripts in the start-up folder until it closes. How can I get rid of the welcome screen or shorten the time it pops up. Thanks

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#14 Post by RSH »

By the way:

You can see this working in combination in L.A.S.S.I.E. 002, when doing a right-click onto a drive icon and choosing to shutdown the computer (only in L.A.S.S.I.E. 002).

It first unloads all SFS Files that are mounted in the pup_ro mount points, then all ISO, SFS, 2FS, 3FS and 4FS Files under /mnt and at last it unmounts all mounted drives.

Finally the Shutdown-GUI appears on the Screen and you can choose to reboot or shutdown.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#15 Post by RSH »

nic007 wrote:Thanks RSH. Just a little follow up - Puppy's welcome message seems to "hold back" the scripts in the start-up folder until it closes. How can I get rid of the welcome screen or shorten the time it pops up. Thanks
Put the code into script /usr/bin/xwin above that code.

Code: Select all

#now done in /etc/rc.d/rc.modules...
##alsa sound setup...
#if [ "`cat /etc/modprobe.conf | grep 'snd\-card\-0'`" = "" ];then
# #auto option created by BK for fast operation, less questions...
# alsaconf --auto
#fi
Then it will be already mounted when X desktop appears.

More to your question in a few minutes. Need to search for the code.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#16 Post by RSH »

(Have you noticed my previous additional posts?)

Ok.

File /usr/sbin/delayedrun contains the code:

Code: Select all

  #if [ -c /dev/mixer ];then #110113 test for sound ready, see /etc/init.d/10alsa.
  # aplay /usr/share/audio/2barks.au &
  # #wavplay /usr/share/audio/2barks.wav &
  # RETAPLAY=$?
  # PIDAPLAY=$!
  #fi
  welcome1stboot & #110412 now in /usr/sbin
Just comment it out = #welcome1stboot & #110412 now in /usr/sbin.

To get rid of the personal settings popup gui create file, /tmp/etc/personal_settings_popup_disabled when remastering offers option to edit /tmp/etc - it's just an empty file.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#17 Post by nic007 »

Feedback - using a remaster of puppy 412 I ran into the following problems. Placing RSH's mount script in xwin as advised, my puppy won't start X. Starting X message and then nothing happens. Alright back to keeping the script in startup folder, works but clicking on the first partition icon and three instances of the explorer window opens. I got rid of the welcome message by uncommenting the relevant section in delayedrun script (probably not the correct way but it works).

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#18 Post by nic007 »

RSH wrote:(Have you noticed my previous additional posts?)

Ok.

File /usr/sbin/delayedrun contains the code:

Code: Select all

  #if [ -c /dev/mixer ];then #110113 test for sound ready, see /etc/init.d/10alsa.
  # aplay /usr/share/audio/2barks.au &
  # #wavplay /usr/share/audio/2barks.wav &
  # RETAPLAY=$?
  # PIDAPLAY=$!
  #fi
  welcome1stboot & #110412 now in /usr/sbin
Just comment it out = #welcome1stboot & #110412 now in /usr/sbin.

To get rid of the personal settings popup gui create file, /tmp/etc/personal_settings_popup_disabled when remastering offers option to edit /tmp/etc - it's just an empty file.
My delayedrun file is slightly different in that the location of the welcome1stboot's htm file is stipulated ('usr/share/doc). Nevermind, I actually uncommented that whole section before I actually saw your reply here and the message does not show now. See the other problems I ran into in my previous post.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#19 Post by nic007 »

Jasper wrote:Hi,

Yes, add at the bottom

Code: Select all

sleep 1
rox -D /
My regards
I got a workable "solution" by disabling the welcome message, reducing the intial time-out before running the script (3 seconds instead of 10 seconds) and using your above code (changing the time-out before the window closes to 2 seconds as 1 second is too short). Not perfect but it works.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#20 Post by RSH »

nic007 wrote:Feedback - using a remaster of puppy 412 I ran into the following problems. Placing RSH's mount script in xwin as advised, my puppy won't start X. Starting X message and then nothing happens. Alright back to keeping the script in startup folder, works but clicking on the first partition icon and three instances of the explorer window opens. I got rid of the welcome message by uncommenting the relevant section in delayedrun script (probably not the correct way but it works).
I'm sorry for that.

My Puppies are Remasters of 5.2 and above. Never used a Puppy 4, so I can't say anything on that.

Btw: if placing the Script into xwin, do not place the complete code. Make a extra script from that code, name it mnt_all_drives and place it into /usr/sbin.

Then just put into xwin: /usr/sbin/mnt_all_drives &

Note the '&', which lets a script continue while the called script still runs/executes.

RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

Post Reply