F
F
fokin_nikolay19892016-08-10 21:35:10
linux
fokin_nikolay1989, 2016-08-10 21:35:10

How to write disk mount in bash?

Guys, tell me, how can I implement such a thing: a computer on centos, it has partitions with the ext4 type and 1 ntfs partition, it is necessary that, for example, when executing sh, it finds the ntfs partition and mounts it in the fstab directory Thank you

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
fokin_nikolay1989, 2016-08-11
@fokin_nikolay1989

echo 'Mount NTFS pharma partition'
mkdir /home/$user/Desktop/data
UUID=`blkid -s UUID -o value -t TYPE=ntfs`
echo 'UUID='$UUID' /home/'$user'/Desktop /data ntfs defaults 0 0'

A
Alexey Skobkin, 2016-08-10
@skobkin

it is necessary that, for example, when executing sh, it finds the ntfs partition and mounts it to the fstab directory

You write the mount rules in fstab with the noauto option, and in the config type .bashrc or .zshrc you write mount /mount/point(the same mount point that is specified in fstab) and it is mounted exactly as you described in advance.

A
abcd0x00, 2016-08-11
@abcd0x00

You just do everything by hand, and then you enter each command into a shell script.
It is accepted to mount in / mnt.
It is customary to create a separate directory for a new point.
You need superuser rights to mount. Therefore, you write a regular script, but then run it through sudo.
(And you don't have to touch /etc/fstab to do this.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question