Results 1 to 2 of 2

Thread: Auto mounting Hard drive

Hybrid View

  1. #1
    Junior Member
    Join Date
    Mar 2004
    Location
    Salt Lake UT
    Posts
    9

    Auto mounting Hard drive

    I add a peace of script to /etc/rcS.d/S00knoppix-autoconfig to search for a specific file on the rott of a partition. What is does is it mounts all possible partitions and then searches root for a file. When the file is found it will mount that partition as /mnt/hda1. It works, but there is 2 problems

    1-after it goes through the process of searching the partitions it re-runs the auto config process again where it will re-search for devices and usb devices and configure them again.

    2-I get an error every time it tries to mount a non existent partition. I have it forwarding the messages to /dev/null, and it does not get the messages when I test run just my code alone. But when it is run with the boot process it gets this message about 30 times:

    Code:
    modprobe: modprobe: Can't locate module block-major-34

    here is the code I added:

    Code:
    # Locate Config File CONFPART.F
    findconf(){
       LOC=0
       # search all partitions for a file in the root directory
       for i in /mnt/tmp ; do
          # See if it's already mounted
          [ -f "$i/$1" ] &&  { echo "$i/$1"; return 0; }
          if [ -d "$i" ] && mount -r "$i" 2>/dev/null; then
             [ -f "$i/$1" ] && LOC=0
             umount -l "$i" 2>/dev/null
             [ -n "$LOC" ] && { echo "$LOC"; return 0; }
          fi
       done
    
    }
    
    searchdrv(){
       DRIVES="/dev/[h-s]d[a-z][0-9]"
       CONFDRV=""
       LOC=0
    
       for drv in $DRIVES ; do
          if (mount $drv /mnt/tmp 2>/dev/null) ; then
             LOC="$(findconf CONFPART.F)"
             if test "$LOC"; then
                CONFDRV=$drv
                return 0
             fi
             umount /mnt/tmp
          fi
       done
    return 0
    }
    .
    .
    .
    .
    .
    mkdir /mnt/tmp
    mkdir /mnt/hda1
    searchdrv
    echo Found CONFPART.F file in $CONFDRV
    mount -rw $CONFDRV /mnt/hda1
    let me know if anyone has an idea

  2. #2
    Junior Member
    Join Date
    Mar 2004
    Location
    Salt Lake UT
    Posts
    9
    I have been revising my code so that it is cleaner and runs smother buy I still have the same problems

    here is the code:
    Code:
    # Locate ProQuest Config File CONFPART.F
    findconf(){
       LOC=0
       # search all partitions for a file in the root directory
       for i in /mnt/tmp ; do
          # See if it's already mounted
          [ -f "$i/$1" ] &&  { echo "$i/$1"; return 0; }
       done
    return 0
    }
    
    
    searchdrv(){
       DRIVES="/dev/[h,s]d[a-z][0-9]"
       CONFDRV=""
       LOC=""
       for drv in $DRIVES ; do
          if mount -rw $drv /mnt/tmp >/dev/null 2>&- ; then
             LOC="$(findconf CONFPART.F)"
             [ -n "$LOC" ] && { umount /mnt/tmp; echo $drv; return 0; }
             umount /mnt/tmp
          fi
       done
    return 0
    }
    
    # locate ProQuest config partition and mount as hda1
    mkdir /mnt/tmp 2>&-
    mkdir /mnt/hda1 2>&-
    
    # Search for config files
    echo "0" > /proc/sys/kernel/printk
    EXISTS="$(searchdrv)"
    if test "$EXISTS"; then
       echo "${CRE}${BLUE}Found CONFPART.F in ${MAGENTA}$EXISTS"
       mount -rw "$EXISTS" /mnt/hda1 2>&-
    else
       echo "${CRE}${RED}Local config files not loaded"
    fi

Similar Threads

  1. mounting hard drive
    By coffee_monster in forum Hardware & Booting
    Replies: 2
    Last Post: 07-18-2005, 01:58 PM
  2. drive mounting
    By Phishman in forum Hardware & Booting
    Replies: 4
    Last Post: 02-04-2005, 04:09 AM
  3. auto recognition of USB pen drive after HDD
    By softgun in forum Hdd Install / Debian / Apt
    Replies: 0
    Last Post: 08-29-2004, 06:12 AM
  4. How to make an auto CDROM mounting script?
    By Blue in forum Customising & Remastering
    Replies: 2
    Last Post: 06-26-2003, 12:02 PM
  5. Auto mount of hard disk drive
    By Mycroft1855 in forum Customising & Remastering
    Replies: 1
    Last Post: 02-27-2003, 05:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Acer Predator Helios Neo 16S AI 16

Acer Predator Helios Neo 16S AI 16" i9 275HX 2S RTX 5070 Ti 32GB 1TB SSD Refurb

$1671.47



Dell Latitude 14

Dell Latitude 14" Laptop Computer Intel i5 Up To 32GB RAM 1TB SSD Windows 11 Pro

$316.61



Dell Latitude 14

Dell Latitude 14" Laptop Computer Intel i7 Up To 32GB RAM 1TB SSD Windows 11 Pro

$349.48



External SSD 1TB 2TB 4TB Portable Hard Drive USB 3.0 Type-C High Speed PC Mac picture

External SSD 1TB 2TB 4TB Portable Hard Drive USB 3.0 Type-C High Speed PC Mac

$19.99



SAMSUNG T7 Portable SSD 1TB Indigo Blue USB 3.2 Gen2 External MU-PC1T0H/AM picture

SAMSUNG T7 Portable SSD 1TB Indigo Blue USB 3.2 Gen2 External MU-PC1T0H/AM

$159.99



Crucial MX500 1TB 2.5

Crucial MX500 1TB 2.5" SATA III Internal SSD CT1000MX500SSD1

$99.99



Netac 2TB 1TB 500GB Internal SSD M.2 NVMe PCIe3.0 Solid State Drive lot picture

Netac 2TB 1TB 500GB Internal SSD M.2 NVMe PCIe3.0 Solid State Drive lot

$129.99



Acer Aspire 14

Acer Aspire 14" AI Copilot+PC Laptop Core Ultra 5 226V Gen 4 ARC 16GB 1TB Refurb

$462.74



Samsung 2.5

Samsung 2.5" 870 EVO SSD SATA III 250GB 500GB 1TB Internet Solid State Drive Lot

$90.00



Western Digital 1TB 3.5

Western Digital 1TB 3.5" SATA III 7200RPM Desktop Hard Drive

$34.99