LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to Mount usb drive and other questions (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-mount-usb-drive-and-other-questions-4175426730/)

Kallaste 09-21-2012 08:19 AM

Ah. That is because you entered

Code:

mkdir /mnt/sdb
instead of

Code:

sudo mkdir /mnt/sdb
The command 'sudo' allows you to take superuser (or root) privileges for one command. After you enter this line of code, you will be prompted for your root password. You need to enter the password as directed and then proceed with the instructions.

This is necessary because only the superuser has the permissions necessary to create a directory there.

Or, of course, you could just switch to another Ubuntu.

lleb 09-21-2012 08:34 AM

long n short of getting a flash drive set to mount.

as root

# mkdir /mnt/foo replace foo with something that you can remember ie: usb
# fdisk -l from that you are looking for the /dev/sdX and the file type of the flash drive
# fdisk /dev/sdX (if you wish to format it for ext3 to run native in Linux) Ignore this step if you want to leave it as FAT32
d (this will delete all partitions on the drive)
n (create new partitions)
p (for primary)
1 (you only need 1 partition atm)
hit enter until it is prompting again without quesitons
w (write the change to the drive)
# mkfs -t ext3 /dev/<partition>
# tune2fs -c 0 /dev/<partition> only if you do not want to have the system force a file check after roughly 120 mounts
# vi /etc/fstab
add the following entry:

/dev/<partition> /mnt/foo ext3 auto,users,rw 0 0

if you want user to be able to mount/umount the drive then you need to add the following to visudo

at the end of the user line:

, /bin/mount /mnt/foo, /bin/umount /mnt/foo

then mount the drive:

# mount /mnt/foo
# chmod 4777 /mnt/foo (this is really really lose, not safe unless you KNOW you are the ONLY one with acesss to your system) if not set the permissions chmod 755 /mnt/foo
# if you set 755, then you need to also chown -Rf user:users_group /mnt/foo
# umount /mnt/foo
# exit
$ sudo /bin/mount /mnt/foo (no trailing / just like you did in visudo)
$ touch /mnt/foo/test if this works without permissions issues you are set.

fin.


All times are GMT -5. The time now is 02:00 AM.