I'm new to Ubuntu. In order to mount the hard disk, I added the following line to /etc/fstab
and saved it.
/dev/sda1 /home/mine/hd1 ext4 auto,exec,users,rw 0 0
output of sudo fdisk -l
:
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1BE4FADE-5038-4B8E-BA1A-11E38749A593
Device Start End Sectors Size Type
/dev/sda1 2048 7814035455 7814033408 3.7T Linux filesystem
Disk /dev/sdb: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 46108040-B863-4181-94EF-8DEEF7ACD4D5
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 201078783 200028160 95.4G Linux filesystem
/dev/sdb3 201078784 234440703 33361920 15.9G Linux swap
/etc/fstab:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb2 during installation
UUID=e4488cf9-7c51-4456-8626-bfe96ba919a8 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=3144-2FF0 /boot/efi vfat umask=0077 0 1
# swap was on /dev/sdb3 during installation
UUID=4189137f-17b2-484c-83a9-8ca406d68cad none swap sw 0 0
/dev/sda1 /home/cpl/hd1 ext4 auto,exec,users,rw 0 0
However, I find it does not work after I reboot. For example, I want to run /home/cpl/hd1/a.out
and it shows
bash: /home/cpl/hd1/a.out: Permission denied
I tried the command chmod
, but failed.
How can I get all permissions? (p.s. I find that if I delete the line I added to /etc/fstab
and run sudo mount /dev/sda1 ~/hd1
, I will get excute permission. The thing is you need run it again every time you boot.) Here are the output of sudo ls -alh ~/hd1
before and after I exectue sudo mount /dev/sda1 ~/hd1
.
Before:
total 8.0K
drwxrwxr-x 2 cpl cpl 4.0K Sep 4 17:39 .
drwxr-xr-x 21 cpl cpl 4.0K Sep 5 10:22 ..
After:
total 44K
drwsr-xr-x 8 cpl cpl 4.0K Sep 5 00:46 .
drwxr-xr-x 21 cpl cpl 4.0K Sep 5 10:22 ..
drwsr-xr-x 2 cpl cpl 4.0K Sep 4 18:53 beifen
drwsr-xr-x 3 cpl cpl 4.0K Sep 4 20:37 fanqiang
drwsr-xr-x 2 cpl cpl 16K Sep 1 14:02 lost+found
drwsr-xr-x 2 cpl cpl 4.0K Sep 4 16:01 test
drwsr-xr-x 5 cpl cpl 4.0K Sep 3 20:25 .Trash-1000
drwsr-xr-x 2 cpl cpl 4.0K Sep 4 21:00 utorrent
Finally I fixed it out but forgot to record here. Actually I just made a little change to the line I had added to /etc/fstab
:
/dev/sda1 /home/cpl/hd1 ext4 auto,users,exec,rw 0 0
The thing is users
should be in front of exec
. Worked for me.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments