LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   can some tell me how to mount 2nd HD (https://www.linuxquestions.org/questions/linux-hardware-18/can-some-tell-me-how-to-mount-2nd-hd-600564/)

driftboy 11-18-2007 08:13 AM

can some tell me how to mount 2nd HD
 
Hi,

I am using debian etch and I need to know how to mount a 2nd hard drive for extra space. Would like it to auto mount with any login users to us it.

ty

Th3_J3st3R 11-18-2007 09:52 AM

Please, use the SEARCH, or use your MAN pages. Your not going to get anywhere unless you put in the time to read.

man mount

http://www.linuxquestions.org/questi...-drive-359074/

PTrenholme 11-18-2007 10:50 AM

Also consult man fstab for information about mounting during a boot
and look at man mkfs for information about formatting a drive

Sometime an info <subject> presents more details and an easier-to-read alternative to the man command.

Oh, another useful tool is parted for creating and changing disk partitions.

Another thing: If you're moving to *nix from Windows, you should note that *nix system do not force you to create a separate "top-level" entry for different drives. You can attach a file system residing in any hard drive at any point in your file system you want to use. Basically, a *nix system has a single "logical" file system, organized hierarchically below the top level ("/"), almost independent of any physical devices where data is stored.

For illustration purposes only, here's what my Fedora 8 etc/fstab looks like:
Code:

$ cat /etc/fstab
/dev/F8/Base            /                      ext3            defaults          1 1
LABEL=/boot1            /boot                  ext3            defaults          1 2
tmpfs                  /dev/shm                tmpfs          defaults          0 0
devpts                  /dev/pts                devpts          gid=5,mode=620    0 0
sysfs                  /sys                    sysfs          defaults          0 0
proc                    /proc                  proc            defaults          0 0
#/dev/sda3              swap                    swap            defaults          0 0
#/dev/FC7/Swap          swap                    swap            defaults          0 0
/dev/F8/Swap            swap                    swap            defaults          0 0

#Added by hand
# /dev/sda2
UUID=9b52dc27-f2c9-4238-afaa-c8e4691ea777 \
                        /Ubuntu/                ext3            defaults,errors=remount-ro        0 1
# /dev/sda1
UUID=e8e90e29-1025-433d-aaab-fdab05150ddf \
                        /Ubuntu/boot3          ext3            defaults          0 2
# /dev/sdb1
UUID=72ECD97FECD93E53  /XP                    ntfs-3g        defaults,umask=007,gid=10  0 1
/dev/hde                /media/cdrom0          udf,iso9660    user,noauto,exec  0 0
/dev/fd0                /media/floppy0          auto            rw,user,noauto,exec                0 0
/dev/FC7/Base          /Ubuntu/F7              ext3            defaults          0 0
LABEL=/boot            /Ubuntu/F7/boot        ext3            defaults          0 0
/dev/USB_Fedora/Base    /usb                    ext3            defaults,noauto  0 0
LABEL=/usb_boot        /usb/boot              ext3            defaults,noauto  0 0
/dev/sde1              /usb/shared            ext3            defaults,noauto  0 0


jschiwal 11-18-2007 11:15 AM

You probably know this. Before mounting the drive, you need to format it and create a filesystem on the partition.

If any user can use this partition, then it may be best to use the same permissions that the /tmp directory uses. You need to mount the partition before using chmod. "sudo chmod a=rwxt path/to/mountpoint".

Some distro's such as Mandriva & SuSE have a partitioner that can make the process easier. You can use them to create the filesystem (format) and to add an entry to /etc/fstab. Otherwise, you use "sudo /sbin/fdisk /dev/hdb" or "sudo /sbin/fdisk /dev/sdb" to format the partition. You next need to create the filesystem. Here you need to decide which filesystem to use. I am happy with ext3. I have used reiserfs and xfs in the past. Here is what my laptop's /etc/fstab entry looks like for the root partition:
Code:

/dev/disk/by-id/scsi-SATA_FUJITSU_MHU2100_NQ07T4825B7P-part6 / ext3  acl,user_xattr        1 1
You could use the form "/dev/hda1" instead. If you use /dev/disk/by-id/ or /dev/disk/by-uuid/, then make sure you use the value for your partition and not the value that I gave. Simple use "ls /dev/disk/by-id/" to look up your value.

Fedora core uses lvm. You can use the "/usr/sbin/system-config-lvm" program to add your new disk to the lvm volume. This would allow you to increase the size of /home, by adding your new drive to its lvm volume. Otherwise you need to create a mount point for your new partition.

Please put your distro in your LQ profile. That would enable us to give better answers.

driftboy 11-19-2007 12:37 AM

I dont understand, please just post the codes.

I want to auto mount /dev/hdb1 /media/storage so that all users on this computer can read and write to it.

ty

file system ext3

Nylex 11-19-2007 01:01 AM

To reiterate: read the man page for mount. It's really not hard.

driftboy 11-19-2007 02:17 AM

why not just say

add to /etc/fstab
/dev/hdb1 /media/storage ext3 rw,user 0 0

PTrenholme 11-19-2007 01:36 PM

Quote:

Originally Posted by driftboy (Post 2963772)
why not just say

add to /etc/fstab
/dev/hdb1 /media/storage ext3 rw,user 0 0

Well, because there are lots of options you can use, and it wasn't clear what you actually wanted.

For example, the "0 0" at the end of your proposed line disables fsck boot-time checking of the file system, and would only normally be done for file systems that a not mounted during the boot process. (In my example, above, that's what the "noauto" option is for -- to tell udev that the file system is on removable media, and that it might not be available when the system is booted.)

Also, by specifying "rw,user" you have granted r/w access to whoever mounts the file system, and permitted any user to do so. Since the file system will (implicitly) be mounted during the boot process, it will be owned by "root" and be in the "root" group. Thus the system administrator will need to set access and ownership values for any files in /media/storage before anyone else will be able to use the device. (Note that a "directory" is, on *nix systems, just another type of file.) While this may be what you want, again it was neither clear nor usual that you would want to do so. More commonly one just uses the "defaults" option on boot-mounted file systems, and then sets the permissions on /media/storage like this: chmod u+rwxt,g+rwx,o+rwx /media/storage so that everyone can read or execute any file in the "storage" directory, but only the user that created the file (or "root") can delete the file. (These are the permissions that are set on the /tmp directory.)

All the above is why we were recommending that you read the manual pages for the commands you intend to use. We can't read your mind to know what you want, and, as you specified in your example, when what you want is not "standard" you either need to provide more details or, as we suggested, read the information provided in your distribution and see how you want to do it.

The power and problem with systems like Linux is that you can do almost anything you want to do with the system (power), but you have to know how to do it (problem). And the documentation can be overwhelming since it needs to cover all the possibilities, not just the "common" ones.

driftboy 11-19-2007 05:33 PM

Thank you PTernholme, That is what I needed to know. I am gonna keep studying your advice and hope to understand linux better.


All times are GMT -5. The time now is 04:51 AM.