How to auto mount multiple hdd's on boot up?

Booting, installing, newbie
Message
Author
User avatar
The Mighty Windle
Posts: 6
Joined: Sat 30 Jun 2007, 17:04
Location: Scunthorpe, Britain's answer to water-torture
Contact:

How to auto mount multiple hdd's on boot up?

#1 Post by The Mighty Windle »

Could someone please tell me what i need to insert and where (oo-er!) script-wise to get Puppy to auto mount all my hard disks? :shock:

bugman

#2 Post by bugman »

I have the following in /etc/fstab

Code: Select all

/dev/hdb1     /mnt/hdb1    ext3     defaults               0 0
and in /etc/rc.d/rc.local

Code: Select all

mount /dev/hdb1
Additional disks as needed...

User avatar
The Mighty Windle
Posts: 6
Joined: Sat 30 Jun 2007, 17:04
Location: Scunthorpe, Britain's answer to water-torture
Contact:

Cheers!

#3 Post by The Mighty Windle »

Thanking you muchly bugman, worked a treat! :D

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#4 Post by PaulBx1 »

Doesn't /etc/fstab (unlike rc.local) get replaced in an update? If so, wouldn't it make sense to put all the info in the mount command itself, in rc.local? (If that can be done; I'm not actually sure it can.)

I know in regular linux and unix systems fstab is part of the the administrator's data, but I think with Puppy it is more like something static that comes with the system. That's how I've been looking at it anyway, not sure it's correct. I haven't done a "mount -a" in Puppy yet!

User avatar
willhunt
Posts: 495
Joined: Wed 05 Oct 2005, 18:19

How to mount all your Drives at bootup

#5 Post by willhunt »

if you are using the live-cd option
you need to add it to fstab everytime like this from rc.local

Code: Select all

# add new entry to the bottom of fstab you need one for each drive
# some vaild coloum 3 options ext2, ext3, reiserfs, swap, vfat, ntfs, 
#auto means filesystem type is detected automatically.
echo /dev/hdb1     /mnt/hdb1    auto     defaults               0 0 >>/ect/fstab
# you must make the directory for each fstab entry before you try to mount or it will fail
mkdir /mnt/hdb1
#then the mount -a should work to mount all your partitions defined in fstab
mount -a 
or

you could use edit-initrd.pupand edit /ect/fstab in the initrd.gz from your puppy iso to reflect the drives in your machine then ISOmaster to copy the new initrid.gz back to the iso be sure to rename the iso file :) both methods should work fine for a full hd install you only need edit the /ect/fstab once :D
[url=http://hostfile.org/icepak.pet]176 Icewm Themes :!:[/url]
[url=http://tinyurl.com/39fl3x]vlc-0.8.6c-i586.pet[/url]
[url=http://tinyurl.com/2q7cbp]vlc-0.8.6c-i586.pet[/url]

User avatar
willhunt
Posts: 495
Joined: Wed 05 Oct 2005, 18:19

just a hack in progress

#6 Post by willhunt »

I hacked up the probepart3 script and got this hope it helps

Code: Select all

#!/bin/sh
#LGPL 2007 Puppy Linux www.puppyos.com
#replacement for antonio gallo's probepart.
#written by plinej (Jason). Some mods by BK.
#April 25th 2007
# badly abused by Dougal, April 26th
# update: May 3rd

#[ -d $HOME/.config/tmp ] || mkdir -p $HOME/.config/tmp 2>/dev/null
#SUNITS="$1" #allowed params are '-k' or '-m'.
rm -f $HOME/.config/tmp/probepar*

OUTPUT=""
###get partitions
# scsi cds and devs without partitons
#SCSIPARTS="`grep -E 'scd[0-9]|sd[a-z] ' /proc/diskstats | tr -s ' ' | cut -d' ' -f4 | tr '\n' ' '`"
SCSIPARTS="`ls -1 /sys/block | grep -E 'sd[a-z]|sr[0-9]' | tr '\n' ' '`"
# normal partitions (sorting backwards cosmetic: we're adding new items at
# the beginning
PARTS="`grep '[hs]d[a-z][0-9]' /proc/partitions | tr -s ' ' | cut -d' ' -f5 | sort -r | tr '\n' ' '`"

## Dougal: originally had here  the last part (that does most of the work)
## Why did I move it? To get things in a nice order: hda1...hdb1...hdc...sda1..

###get ide drives (other than hard disks)
#SIZE=0
for DEV in `cd /proc/ide ; ls hd[a-z] | sort -r`
do
  # skip devices with partitions
  case "$PARTS" in *$DEV*) continue ;; esac
  if [ "`cat /proc/ide/$DEV/media`" = "cdrom" ]; then
   FSTYPE="iso9660"
  else
   FSTYPE=`/usr/lib/mut/bin/guess_fstype /dev/$DEV 2>/dev/null`
   [ "$FSTYPE" = "unknown" ] && FSTYPE="none" #for compatibility with old probepart.
  fi
#  SIZE=`grep "$DEV$" /proc/partitions | tr -s ' ' | cut -f 4 -d ' '`
#  [ ! "$SIZE" ] && SIZE=0
#  [ "$SUNITS" = "" ] && let SIZE=SIZE*2    #512 byte blocks
#  [ "$SUNITS" = "-m" ] && let SIZE=SIZE/1024 #MB units
#  seem to need this
  if [ $FSTYPE ! "none" ]; then
   OUTPUT="/dev/$DEV    /mnt/$DEV    $FSTYPE    defaults    00"
 mkdir /mnt/$DEV
echo $OUTPUT >>/ect/fstab
mount /dev/$DEV /mnt/$DEV
fi
done

###get scsi drives
for SCSI in $SCSIPARTS
do
  # skip devices with partitions
  case "$PARTS" in *$SCSI*) continue ;; esac
  case "$SCSI" in
   sr*) # cdrom
     MEDIA="cdrom"
     FSTYPE=iso9660
     SIZE=0
     ;;
   sd[a-z]) #other
     MEDIA="Direct-Access"
     FSTYPE=`/usr/lib/mut/bin/guess_fstype /dev/$SCSI 2>/dev/null`
     [ "$FSTYPE" = "unknown" ] && FSTYPE="none" #for compatibility with old probepart.
#     SIZE=`grep "$SCSI$" /proc/partitions | tr -s ' ' | cut -f 4 -d ' '`
#     [ ! "$SIZE" ] && SIZE=0
#     [ "$SUNITS" = "" ] && let SIZE=SIZE*2    #512 byte blocks
#     [ "$SUNITS" = "-m" ] && let SIZE=SIZE/1024 #MB units
     ;;
  esac
  #changed here to output fstab format 
  if [ ! $FSTYPE == "none" ]; then
  OUTPUT="/dev/$SCSI    /mnt/$SCSI    $FSTYPE    defaults    00"
 mkdir /mnt/$DEV
echo $OUTPUT >>/ect/fstab
mount /dev/$DEV /mnt/$DEV
fi
done

# now the part that's actually useful...
for DEV in $PARTS
do
  FSTYPE="`/usr/lib/mut/bin/guess_fstype /dev/$DEV 2>/dev/null`"
  [ "$FSTYPE" = "unknown" ] && FSTYPE="none" #for compatibility with old probepart.
#  SIZE=`grep "$DEV$" /proc/partitions | tr -s ' ' | cut -f 4 -d ' '`
#  [ ! "$SIZE" ] && SIZE=0
#  [ "$SUNITS" = "" ] && let SIZE=SIZE*2    #512 byte blocks
#  [ "$SUNITS" = "-m" ] && let SIZE=SIZE/1024 #MB units
  #changed here to output fstab format
  if [ ! $FSTYPE == "none" ]; then
   OUTPUT="/dev/$DEV    /mnt/$DEV    $FSTYPE    defaults    00"
mkdir /mnt/$DEV
echo $OUTPUT >>/ect/fstab
mount /dev/$DEV /mnt/$DEV
fi
done

#changed here to echo output to /ect/fstab
#echo -e $OUTPUT>> /ect/fstab
#cat $HOME/.config/tmp/probepart #print results.
#rm -f $HOME/.config/tmp/probepar*

###END###

someone try it and let me know
Last edited by willhunt on Mon 09 Jul 2007, 06:18, edited 1 time in total.
[url=http://hostfile.org/icepak.pet]176 Icewm Themes :!:[/url]
[url=http://tinyurl.com/39fl3x]vlc-0.8.6c-i586.pet[/url]
[url=http://tinyurl.com/2q7cbp]vlc-0.8.6c-i586.pet[/url]

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Thanks

#7 Post by ecomoney »

This tip got me a new car! (its complicated....but true!)

Will, am I to understand that this script would automount all disk drives and other devices plugged in when puppy boots?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Doesnt mount USB Drives

#8 Post by ecomoney »

Hi, have tested this (doing a backup system for someone). It doesnt seem to mount usb drives at startup...is there a different way of doing this?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
willhunt
Posts: 495
Joined: Wed 05 Oct 2005, 18:19

#9 Post by willhunt »

sorry bout the wait yes the above script should now mount all your
hard drive for a disscussion on usb look here
http://www.murga-linux.com/puppy/viewtopic.php?t=9581
[url=http://hostfile.org/icepak.pet]176 Icewm Themes :!:[/url]
[url=http://tinyurl.com/39fl3x]vlc-0.8.6c-i586.pet[/url]
[url=http://tinyurl.com/2q7cbp]vlc-0.8.6c-i586.pet[/url]

User avatar
battleshooter
Posts: 1378
Joined: Wed 14 May 2008, 05:10
Location: Australia

#10 Post by battleshooter »

Hope this isn't a dumb question, but where exactly do I place this script Willhunt? I tried searching for "probepart3" but I can't seem to find it.

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#11 Post by muggins »

battleshooter,

I haven't tried the script, but to test it out just copy your existing /sbin/probepart to /sbin/probepart.bak, then copy&paste willhunt's script in a text editor, & save as /sbin/probepart. Then enter:

Code: Select all

chmod +x /sbin/probepart
Then try it out. If not successful, you can restore the .bak verion.

User avatar
battleshooter
Posts: 1378
Joined: Wed 14 May 2008, 05:10
Location: Australia

#12 Post by battleshooter »

Thanks for the quick reply!

It's kinda strange what happened- I did everything like you said Muggins, but when I rebooted and clicked on a shortcut to a folder in a normally unmounted drive, it gave the usual :"File doesn't exist, or I can't access it: /mnt/hda5/My Documents" as if it wasn't mounted. (The shortcut is on the desktop)

But when I looked at it from /mnt/ it showed it was mounted-and it was mounted. I was able to access hda5. Any ideas?

User avatar
battleshooter
Posts: 1378
Joined: Wed 14 May 2008, 05:10
Location: Australia

Solved!

#13 Post by battleshooter »

Just thought I'd mention my problem's been solved. First I used hotpup for automounting, but due to read only ntfs issues, I wrote my own script according to Puppian's post: http://www.murga-linux.com/puppy/viewtopic.php?t=2996

It worked a treat, and automounted everything after editing /root/.xinitrc.

Bruce B

Re: Doesnt mount USB Drives

#14 Post by Bruce B »

ecomoney wrote:Hi, have tested this (doing a backup system for someone). It doesnt seem to mount usb drives at startup...is there a different way of doing this?
It's a Puppy quirk. I'll describe it in two phases:

1) Linux boots to the prompt

At this point Puppy doesn't likely have all the USB modules loaded.

Boot to prompt and type lsmod. Note which USB modules are loaded.


2) Start X

Something in running xwin gets the missing module loaded. Not run lsmod and see what that module is.

Install that module in rc.local using the modprobe command and before the instructions to mount devices.

-------------------------

The problem is that rc.local runs before xwin.

See if this works.

User avatar
tgeer43
Posts: 45
Joined: Fri 22 May 2009, 04:08

Re: How to auto mount multiple hdd's on boot up?

#15 Post by tgeer43 »

I didn't mess with fstab and I didn't run any long script since I already know the drives that I want mounted. I just added the following two lines (per drive to be mounted) to my /etc/rc.d/rc.local:

Code: Select all

mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
Does it need to be any more complicated than this?

tgeer

User avatar
battleshooter
Posts: 1378
Joined: Wed 14 May 2008, 05:10
Location: Australia

Re: How to auto mount multiple hdd's on boot up?

#16 Post by battleshooter »

tgeer43 wrote:I didn't mess with fstab and I didn't run any long script since I already know the drives that I want mounted. I just added the following two lines (per drive to be mounted) to my /etc/rc.d/rc.local:

Code: Select all

mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
Does it need to be any more complicated than this?

tgeer
The way you suggested works, but I've always done it like this:

Code: Select all

mount -t ext2 /dev/sda1 /mnt/sda1
Not sure why we were to fiddle with fstab. It may have been something that has been changed since 2xx series. Maybe someone will enlighten us.

Battleshooter
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=94580]LMMS 1.0.2[/url], [url=http://www.murga-linux.com/puppy/viewtopic.php?t=94593]Ardour 3.5.389[/url], [url=http://www.murga-linux.com/puppy/viewtopic.php?t=94629]Kdenlive 0.9.8[/url]

User avatar
paulh177
Posts: 975
Joined: Tue 22 Aug 2006, 20:41

#17 Post by paulh177 »

I noticed that willhunt's scripts all make reference to /ect/ and not /etc/

"it'll never work" :)

SilentBob999
Posts: 4
Joined: Thu 10 Dec 2009, 04:57

Re: How to auto mount multiple hdd's on boot up?

#18 Post by SilentBob999 »

battleshooter wrote:
tgeer43 wrote:I didn't mess with fstab and I didn't run any long script since I already know the drives that I want mounted. I just added the following two lines (per drive to be mounted) to my /etc/rc.d/rc.local:

Code: Select all

mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
Does it need to be any more complicated than this?

tgeer
The way you suggested works, but I've always done it like this:

Code: Select all

mount -t ext2 /dev/sda1 /mnt/sda1
Not sure why we were to fiddle with fstab. It may have been something that has been changed since 2xx series. Maybe someone will enlighten us.

Battleshooter
thanks you

adding line

Code: Select all

mount -t ntfs /dev/sda6 /mnt/sda6
in /etc/rc.d/rc.local work like a charm... nothing in fstab... and its read/write on ntfs...
paulh177 wrote:I noticed that willhunt's scripts all make reference to /ect/ and not /etc/

"it'll never work" Smile
mmh its true

fmmarzoa
Posts: 4
Joined: Tue 19 Oct 2010, 15:32

Hmmmmmmmmm... NTFS rw support?

#19 Post by fmmarzoa »

Hello,

I'm still having problems with this. It mounts the device as ro, but I want it to be rw.

I've the following line on /etc/fstab:

/dev/sdb1 /mnt/iomega ntfs rw 0 0

But when I do a:

mount /dev/sdb1

It mounts it with the following options (according to mount command w/o parameters).

ro, relatime, uid=0, gid=0, fmask=0177, dmask=077,nls=iso8859-1,mft_zone_multiplier=1

I rather like to use utf-8 also, but first I need to mount it rw.

BTW, I use NTFS because I planned to use this hard disk also for sharing things with other windows hosts, and due to journaling not available on vfat.

Thanks again,

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

Re: Hmmmmmmmmm... NTFS rw support?

#20 Post by RetroTechGuy »

fmmarzoa wrote:Hello,

I'm still having problems with this. It mounts the device as ro, but I want it to be rw.

I've the following line on /etc/fstab:

/dev/sdb1 /mnt/iomega ntfs rw 0 0

But when I do a:

mount /dev/sdb1

It mounts it with the following options (according to mount command w/o parameters).

ro, relatime, uid=0, gid=0, fmask=0177, dmask=077,nls=iso8859-1,mft_zone_multiplier=1

I rather like to use utf-8 also, but first I need to mount it rw.

BTW, I use NTFS because I planned to use this hard disk also for sharing things with other windows hosts, and due to journaling not available on vfat.

Thanks again,
It is possible that your NTFS volume was not cleanly unmounted, and so Puppy (and most other Linux systems) will not permit writing to the volume (as this might corrupt it).

Try putting the drive back on your Windows machine and perform a scan to correct any errors, then try mounting under Puppy again.

You could also try "ntfsfix" (open rxvt, and type the command at the prompt)

Incidentally, I use this on my WinXp to access ext2 volumes:

http://www.fs-driver.org/

Though it tends to be unhappy if you have more than 1 ext2 partition.
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Post Reply