Linux-Noob Forums

Full Version: ESATA drive mounting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I have installed a cable that lets me connect the internal SATA connection on my CPU to an ESATA connection on a removable hard drive.

 

I would like to be able to swap removable hard drives, and continue to use this ESATA connection (vs. old USB connection)

 

 

I am unsure how to mount this new type of connection (the USB way used to 'just work')

 

 

I have done an 'fdisk -l' and discovered that the drive is this:



Code:
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      121602   976762552+   b  W95 FAT32




 

as root I then typed:

 



Code:
mkdir /archive
mount /dev/sdc1 /archive




 

This has allowed the drive to show up as read only - but not writable for users (not root)

 

 

Is there a different way that I need to mount this drive in order for it to be read and writable by other users of the system?

Can I add this mount information to my /etc/fstab file so that no matter what drive is connected to the ESATA cable it will show up as '/archive'? (will it always be /dev/sdc1 ? (There are 2 other drives in the CPU that are sda and sdb))

Can I 'hot swap' this ESATA connection by

Code:
umount /archive


and then swapping the drive out and somehow remounting? (or will I have to reboot between drive changes?)

 

 

Thanks for advice.

 

Jeff


Quote:This has allowed the drive to show up as read only - but not writable for users (not root)

 

Is there a different way that I need to mount this drive in order for it to be read and writable by other users of the system?
Yup - use the UID/GID options. Check this post.

https://www.linux-noob.com/forums/index.php?/topic/4050-set-chown-and-chmod-in-external-hdd/page__view__findpost__p__14509

 

Quote:Can I add this mount information to my /etc/fstab file so that no matter what drive is connected to the ESATA cable it will show up as '/archive'?
Yup, but I'd flag it as non-automatic mount, plus add an option that allows an ordinary user to mount it (rather than root), which saves escalating to root to perform it.

Quote:(will it always be /dev/sdc1 ?
Provided you don't drop another controller card in, or plug in a USB pen prior to the ESATA disk mount.

 

If you're worried about the paths changing, consider using UUIDs rather than the device path.

Quote:Can I 'hot swap' this ESATA connection by
Code:
umount /archive

<div>
and then swapping the drive out and somehow remounting? (or will I have to reboot between drive changes?)

</div>
Yup, you should be able to unmount, unplug then replug and remount. Just pause slightly after plugging in (use "fdisk -l" to see if it's listed, or "dmesg" to see if it's detected).

 

No reboot necessary.

 

Hope that helps!

 

(nb: your double-post was corrected, in case you're wondering where it vanished to!)


Thanks for the advice. The hot swap info is great to hear.

I will add the UID and GID to the fstab.

 

Why would I want it NOT to automatically mount? Does it try to auto mount whenever I connect a new drive? (like USB disk?)

I think that I would like this behavior, however if it causes some of the other actions to fail then I'll give it up. (I guess I don't understand what 'auto-mount' means)

 

The line in my fstab file now reads:

 

/dev/sdc1 /mnt/archive auto rw,users,uid=100,gid=100,auto,sync 0 0

 

When I run mount -a I get an error message that says "mount: you must specify the filesystem type" (I suppose this is indicating that maybe I need to specify that it is vfat or hfs rather than using 'auto'.

 

Is there any way to set up this line to handle either kind of drive?

(I've got a lot of archive drives that are already formatted vfat, as well as a few that are hfs)

 

Thanks again,

Jeff


Quote:Why would I want it NOT to automatically mount? Does it try to auto mount whenever I connect a new drive? (like USB disk?)
If you reboot your machine without the USB device plugged in, Linux will try to mount a device that doesn't exist, and may stall on bootup.

 

Modern distros will usually timeout after a specific threshold so that an error in the fstab file doesn't leave a hanging/non-booting system. However, it is recommended that if you know the device may be unavailable at boot-time (externally-attached HD, rather than an internally-attached one) then it is usually better to have it non-auto mount and let some script later take care of it.

 

If you want it to mount automatically when you plug it in (which is what you're thinking of), that's another matter. This can be done using what's called the event-driven framework (event.d), which is safer since it tries to do the mount upon detection of the device being plugged in, rather than upon system reboot.

 

Quote:The line in my fstab file now reads: 

/dev/sdc1 /mnt/archive auto rw,users,uid=100,gid=100,auto,sync 0 0

 

When I run mount -a I get an error message that says "mount: you must specify the filesystem type" (I suppose this is indicating that maybe I need to specify that it is vfat or hfs rather than using 'auto'.
It can be odd like that. When I used ReiserFS, I specified the filesystem type as "reiserfs" and Linux moaned that it didn't recognise that parameter. When I flicked it to "auto", my log messages said that it detected and used "reiserfs" as the mount option. Go figure on that one!

 

Quote:Is there any way to set up this line to handle either kind of drive?(I've got a lot of archive drives that are already formatted vfat, as well as a few that are hfs)
I would create two mountpoints: /media/vfat and /media/hfs then add the following lines into my fstab:



Code:
/dev/sdc1 /media/vfat_disk vfat rw,users,uid=100,gid=100,noauto,sync 0 0
/dev/sdc1 /media/hfs_disk hfs rw,users,uid=100,gid=100,noauto,sync 0 0




It then means I can try either of the following commands:



Code:
mount /media/vfat_disk
mount /media/hfs_disk




.. and know one of them will work. I did this with a USB pen so I could mount either FAT16, FAT32 or EXT3 filesystems on it. It's a bit of a workaround.

 

nb: good call on "mount -a" (or "mountall") - it's a good way of checking that your entries in the /etc/fstab file are correct, rather than waiting for a reboot to discover there's an error!