[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[solved] Re: fstab entries for two different pendrives?



On Saturday 26 August 2006 11:56, Rodolfo Medina wrote:

>> I have the following problem:
>> yesterday I bought a new 256 MB pendrive, that wants to be mounted
>> as `/dev/sda' whereas the other one I have wants `/dev/sda1'.
>> Now, if in /etc/fstab I put the sda entry first, then can't mount sda1;
>> and vice versa, if I put sda1 first then I can't mount sda.


Alan Chandler <alan@chandlerfamily.org.uk> writes:

> Use udev to recognise the pendrive from its manufactures name, and create a 
> symlink (or actual device) called /dev/flash.  Mount that in /etc/fstab
>
> [...]
>



Rodolfo:

>> I forgot to say that my kernel is the 2.4, so udev is not for me - is it?


Alan:

> Why not upgrade?


Rodolfo:

> Because, very likely I should re-learn and re-do all I can do with Debian,
> re-write many howtos and packages installations.
> Hard long work.
>
> [...]
>
>> fstab alone should be sufficient to mount any device.
>> I'd like to understand *why* it can't manage two sd* devices together,
>> or what's the proper way to make it do.



Alan:

> The problem is (and one of the reasons udev was invented) is that either you 
> dynamically allocate device ids as they are hotplugged, or you have to 
> pre-allocate a device for every possible device (not really realistic).
>
> Once you have dynamic allocation of devices, the order of plugging them in 
> matters, and that prevents you knowing which is going to be sda and which is 
> going to be sdb.


Rodolfo:

> Maybe the problem might be worked out if I could change the old pen's
> device into sda as well?
> I noticed that my old pendrive can only be mounted as /dev/sda1,
> whereas the new one indifferently with /dev/sda or /dev/sdb.
> If both pendrives had the same device then I could put just one entry
> in fstab and the plugging order would not be very important.
> I do want to use both, but one at a time.
> Is there a way one can change /dev/sda1 into /dev/sda or /dev/sdb
> for the first pendrive?


Alan:

> possibly,  but this is pure speculation on my part.  when your pen without 
> partiions is in /dev/sda, run fdisk /dev/sda and create one partition on it.
 
> Then use mkfs -t vfat to format /dev/sda1


It seems to be solved now.
I'm reoprting the whole procedure.

Thanks,
Rodolfo


---------------------------------------------------------
I bought a new pen drive: the old one required `/dev/sda1'
and the new one /dev/sda.
This means that there was some unnecessary partition in the old pen drive.
This created problems when I wanted to mount both pen drives
(see below), so I wanted to delete that partition. I did:

 # apt-get install dosfstools

. I canceled the `sda1' entries from fstab, then rebooted.
I inserted the old pen drive, and:

 # fdisk /dev/sda

, and deleted the existing partition with `d'.
Then I created a new one with: `n', `p', `1', and first and last
cylinder the default ones. Then I did: `t' and `6' to select fat16
as partition type. I did `w' to save change and exit fdisk.
Then I did:

 # mkfs.msdos -I /dev/sda

. Now the old pen drive required /dev/sda just as the new one.
In fstab I replaced the line:

 /dev/sda1       /mnt/sda1 	vfat    sync,rw,user,noauto  0       0

with the two:

 /dev/sda        /mnt/sda 	vfat    sync,rw,user,noauto  0       0
 /dev/sdb        /mnt/sdb 	vfat    sync,rw,user,noauto  0       0

. Now, when I wanted to mount a pen drive, I did:

 $ mount /mnt/sda

. If I wanted to mount both pen drives, I did

 $ mount /mnt/sda

for the first one, and

 $ mount /mnt/sdb

 for the second one. This order is always valuable: after inserting a pen drive
in /dev/sda, the second one will be in /dev/sdb. This is true also when using
`parted' and `fdisk', even when the devices are not actually mounted:
if you use parted with the second pen drive, you have to start it with:

 # parted /dev/sdb

, and fdisk with

 # fdisk /dev/sdb

. The above problem arised because the old pen drive was /dev/sda1,
and this made it impossible to edit fstab in a proper way to mount both.



Reply to: