LinHES Forums
http://forums.linhes.org/

Install new External USB HD
http://forums.linhes.org/viewtopic.php?f=1&t=19370
Page 1 of 1

Author:  Digriz77 [ Thu Dec 25, 2008 9:42 pm ]
Post subject:  Install new External USB HD

Hi,

I have been searching all morning for this.

I have a extenal usb western digital 1tb hard drive im trying to connect.

What is the best method to install this drive. All im going to use it for is a storage spot for all my music, photos and videos. I have a internal 320 gig hd which ill use for tv recordings.

Ive never mounted a disk before and wasnt sure if it was a plug n play thing.

Any advice would be great.

Author:  graysky [ Fri Dec 26, 2008 5:30 am ]
Post subject: 

If your drive already partitioned/formatted? If so, what file system did you se (FAT32/NTFS/ext3/XFS, etc.)? If it's unformatted, I'd suggest using gparted to set up the drive. You can either install it on your KM box or download a live LINUX CD that runs it, or USB stick, or even PXE network boot version (all are very slick and 100 % free)!

Once it's partitioned and formatted, you simply need to mount it to your KM box. I haven't done this before, but google is your friend in these cases:

Suggested search: http://www.google.com/search?q=linux+usb+hdd

One hit that looked promising:
http://www.basicallytech.com/blog/index ... l#hardware

Author:  tjc [ Fri Dec 26, 2008 11:27 am ]
Post subject: 

In outline:

1) Be sure to label the drives partitions. This can be done when you partition and format it, or afterwards.

2) Add mount points in /etc/fstab which use those label(s). This is STRONGLY recommended for all removable drives and SATA drives since you can't count on stable device assignments with removable drives in the mix. (For example I've accidentally booted a machine with a USB thumb drive plugged in and had that detected as /dev/sda rather than my internal SATA drive.)

3) Don't forget to create any directories needed for the mount points.

The following shell function is the guts of a script I wrote for auto-labeling partitions. <DISCLAIMER>I'm including it here to show the commands needed for various file system types. It is not intended to be used directly. If you attempt to do so without a reasonable level of Linux skills and understanding of what you're doing, you're in "shoving a cocked and loaded pistol in your waistband and shooting your own **** off" territory.</DISCLAIMER>
Code:
label_one () {
    mountpoint=$1
    device=$2
    fstype=$3

    mp_len=$(echo -n "$mountpoint" | wc -c)
    if [ "$mp_len" -gt 16 ] ; then
        echo "Mountpoint '$mountpoint' is too long to use as a $fstype label!"
        return 1
    elif [ "$fstype" = "xfs" -a "$mp_len" -gt 12 ] ; then
        # Tighter restrictions here...
        echo "Mountpoint '$mountpoint' is too long to use as an xfs label!"
        return 1
    else
        label=$mountpoint
    fi

    case $fstype in
    ext2|ext3) cmd="e2label $device $label" ;;
    jfs)       cmd="jfs_tune -L $label $device" ;;
    xfs)       cmd="xfs_admin -L $label $device" ;;
    reiserfs)  cmd="tunefs.reiserfs -l $label $device" ;;
    swap)      cmd="mkswap -L $label $device" ;;
    *)
        echo "Ignoring $device of type $fstype"
        return 0
        ;;
    esac
    echo "Labeling $fstype partition $device as $label"
    echo $cmd
    $cmd
}


My /etc/fstab file looks like this. The "backup" device is an external eSATA/USB drive. THUMB1 and THUMB2 are both USB sticks, one formated as EXT2 and the other as VFAT. You may also notice that I didn't use the naming convention from the shell function above.
Code:
root@black2:~# more /etc/fstab
# /etc/fstab: filesystem table.
#
# filesystem  mountpoint  type  options  dump  pass
LABEL=Root    /           ext3  defaults,errors=remount-ro  0  1
LABEL=myth    /myth       auto  defaults,auto  0  2
LABEL=swap1   none        swap  defaults  0  0
LABEL=backup  /backup     ext3  defaults  0  0

proc  /proc  proc  defaults  0  0
usbfs  /proc/bus/usb  usbfs  devmode=0666  0  0
sysfs  /sys  sysfs  defaults  0  0
tmpfs  /dev/shm  tmpfs defaults  0  0

/dev/fd0  /floppy  vfat  defaults,user,noauto,showexec,umask=022  0  0
/dev/cdrom /cdrom  auto  defaults,ro,user,noexec,noauto  0  0
LABEL=THUMB1  /mnt/THUMB1 auto  defaults,user,noexec  0  0
LABEL=THUMB2  /mnt/THUMB2 auto  defaults,user,noexec  0  0

Author:  Digriz77 [ Wed Dec 31, 2008 3:09 pm ]
Post subject: 

Thanks for the replies guys. Sorry i havnt responded earlier but I had an electrical storm and although the computer was off i lost a dvb-t card. Im not sure if it came through the antenna or if it was cause i didnt unplug from the wall.

Im up and running with one card now.

So I had actually got the drive mounted. I used webmin for the first time and it added the following to my fstab file

[code]/dev/sda1 /myth/video vfat suid,uid=100,dev,gid=102,exec 0 0
[/code]

the problem is that it wont auto mount i have to after each restart type in x
[code]
mount -a
[/code]
Am i doing anything wrong.....

Thanks for the advice about labels. Im looking at getting a second TB and that will be handy.

Author:  tjc [ Wed Dec 31, 2008 5:00 pm ]
Post subject: 

From my example above:
Code:
LABEL=THUMB1  /mnt/THUMB1 auto  defaults,user,noexec  0  0

Column # 3 - using "auto" works well for most removable drives. You're using "vfat" which should be OK too.

Column # 4 is where you're probably getting into trouble, try changing yours to "defaults,uid=100,gid=102".

Also make sure that this is listed AFTER the one for /myth since you're stacking it on top of that.

OBTW - Reading the fstab and mount ( 8 ) man pages is highly recommended.
Code:
man fstab
man 8 mount

Author:  Digriz77 [ Thu Jan 01, 2009 5:59 am ]
Post subject: 

Hey thanks for that. Here is the changes i made to the fstab... see /dev/sda1. I made the changes... Hasnt helped although mount -a still works. I will have a read of the manual... i didnt know they were there, thanks.

Worst comes to worst i was thinking of waking something in startup that said mount -a.

[code]# /etc/fstab: filesystem table.
#
# filesystem mountpoint type options dump pass
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda3 /myth auto defaults,auto 0 2
#/dev/sda1 /myth/video vfat suid,uid=100,dev,gid=102,exec 0 0
/dev/sda1 /myth/video auto defaults,uid=100,gid=102,exec 0 0

proc /proc proc defaults 0 0
/dev/fd0 /floppy vfat defaults,user,noauto,showexec,umask=022 0 0
usbfs /proc/bus/usb usbfs devmode=0666 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/dev/cdrom /cdrom auto defaults,ro,user,noexec,noauto 0 0
# Added by KNOPPIX
/dev/hda2 none swap defaults 0 0
[/code]

Author:  tjc [ Thu Jan 01, 2009 11:02 am ]
Post subject: 

Digriz77 wrote:
Code:
/dev/hda1  /  ext3 defaults,errors=remount-ro  0  1
/dev/hda3 /myth auto defaults,auto 0 2
/dev/sda1  /myth/video  auto  defaults,uid=100,gid=102,exec  0  0

Using defaults already implies exec so that's redundant. Hmmm... It looks like the mountall.sh boot time init script only auto mounts certain file system types, and the list doesn't include vfat... You can try adding "auto" to the options in column 4 and the autofs support may do the right thing when it detects the drive. This is usually a good idea for external/removable file systems in any case. Failing that, add the following to the end of your /etc/init.d/bootmisc.sh script.
Code:
mount /myth/video

Author:  Digriz77 [ Thu Jan 01, 2009 4:14 pm ]
Post subject: 

Thanks i will give that a go.

I did get it working though through webmin. I went into bootup and shutdown menu and added a bootup action that simply said "mount -a"

Seems to be working now. Is it alright to run that command or will it cause me trouble latter.

Thanks for the help with this.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/