Fstab - How to permanently mount a NTFS partition???

Discussion in 'Installation/Configuration' started by danhansen@denmark, Sep 28, 2014.

  1. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi,


    OS: Ubuntu Server 12.04.5
    FileServer/Samba

    I'm building a fileserver with RAID1 (2 disks) + 2 backupdisks. 1 backupdisk using NTFS and 1 backupdisk using EXT4. Editing the "EXT4" disk gave me no problems, but mounting the NTFS partition does!! I had no problems what so ever, mounting backupdisk2 with the EXT4 filesystem.

    During bootup I get an error:
    An error occurred while mounting /media/backupdisk1


    Please notice that "blkid" doesn't show the disk in question "sda". "fdisk -l" does show the disk. Please notice that RAID1 is on "sdc" and "sdd", the harddisk in question is "sda". "sdb" which is an "EXT4" mounted just fine!:
    Code:
    # ls -l /dev/disk/by-uuid/
    total 0
    lrwxrwxrwx 1 root root  9 Sep 29 00:26 66761273-d381-47fd-ba8a-9f6b4b41c6b2 -> ../../md0
    lrwxrwxrwx 1 root root 10 Sep 29 00:26 8696fa40-c4df-4fdc-9f97-b361fc5ce09a -> ../../sdb1
    lrwxrwxrwx 1 root root  9 Sep 29 00:26 e1c18cc4-dd50-4ceb-b5ca-1b2f6e843302 -> ../../md1

    When I tried to mount it manually:
    Code:
    # mount -t ntfs /dev/sda1 /media/backupdisk1
    NTFS signature is missing.
    Failed to mount '/dev/sda1': Invalid argument
    The device '/dev/sda1' doesn't seem to have a valid NTFS.
    Maybe the wrong device is used? Or the whole disk instead of a
    partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
    

    This is what I have tried so far:
    /dev/sda1 /media/backupdisk1 ntfs defaults,uid=1000,rw 0 0
    /dev/sda1 /media/backupdisk1 ntfs rw,nosuid,nodev,allow_other,default_permissions,bl ksize=4096 0 0

    Here's my Fstab as it looks now:
    Code:
    # /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>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/md1 during installation
    UUID=e1c18cc4-dd50-4ceb-b5ca-1b2f6e843302 /               ext4    errors=remount-ro 0       1
    # swap was on /dev/md0 during installation
    UUID=66761273-d381-47fd-ba8a-9f6b4b41c6b2 none            swap    sw              0       0
    /dev/sda1 /media/backupdisk1 ntfs rw,nosuid,nodev,allow_other,default_permissions,bl ksize=4096 0       0
    /dev/sdb1 /media/backupdisk2 ext4 rw,user,exec  0       0
    I've read somewhere, that it might have to do with rights for the mountpoint/directory. But I haven't got a clue. Read 20-30 manuals, got even more confused. I know there's tools to fix these issues, Srijan told me a lot about these. But I really would like to learn the basics :eek:


    Found this:
    Here: https://help.ubuntu.com/community/AutomaticallyMountPartitions

    Code:
    System name	English name				Linux type
    
    W95 FAT32	MicrosoftFAT32				vfat
    W95 FAT32 (LBA)	MicrosoftFAT32				vfat
    W95 FAT16 (LBA)	Microsoft FAT16				vfat
    W95 Ext'd (LBA)	Microsoft ext				Not used
    NTFS volume set	Microsoft NTFS				ntfs
    NTFS volume set	Microsoft NTFS with read-write access	ntfs-3g
    Apple_HFS	Apple HFS				hfsplus
    So, is this the problem??? Do I need this package to be able to mount permanently/on bootup???

    Looking forward to hear from some of you out there ;)
     
    Last edited: Sep 29, 2014
  2. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Now we're getting somewhere ;)

    Hi,


    Now things start working!! Remember that I couldn't see the UUID when using this command "ls -l /dev/disk/by-uuid/" Now we can se "sda".
    What did I do? I deleted the partition and made a new one, but this time I set the partition ID! Instead of setting it to "default" by choosing "nothing" this apparently coursed issues. Now lets see if we can mount the drive permanently. Now we can even follow the new ubuntu rules and use UUID in "fstab" ;)

    Code:
    # ls -l /dev/disk/by-uuid/
    total 0
    lrwxrwxrwx 1 root root 10 Sep 29 01:00 3815958E15DFB1AC -> ../../sda1
    lrwxrwxrwx 1 root root  9 Sep 29 00:26 66761273-d381-47fd-ba8a-9f6b4b41c6b2 -> ../../md0
    lrwxrwxrwx 1 root root 10 Sep 29 00:26 8696fa40-c4df-4fdc-9f97-b361fc5ce09a -> ../../sdb1
    lrwxrwxrwx 1 root root  9 Sep 29 00:26 e1c18cc4-dd50-4ceb-b5ca-1b2f6e843302 -> ../../md1
    # fdisk -l

    Code:
    # fdisk -l
    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
    81 heads, 63 sectors/track, 382818 cylinders, total 1953525168 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
    Disk identifier: 0x00066956
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048  1953525167   976761560    7  HPFS/NTFS/exFAT
    
    total 0
    lrwxrwxrwx 1 root root 10 Sep 29 01:00 3815958E15DFB1AC -> ../../sda1
    lrwxrwxrwx 1 root root 9 Sep 29 00:26 66761273-d381-47fd-ba8a-9f6b4b41c6b2 -> ../../md0
    lrwxrwxrwx 1 root root 10 Sep 29 00:26 8696fa40-c4df-4fdc-9f97-b361fc5ce09a -> ../../sdb1
    lrwxrwxrwx 1 root root 9 Sep 29 00:26 e1c18cc4-dd50-4ceb-b5ca-1b2f6e843302 -> ../../md1


    .
     
  3. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Success !!!

    Hi,



    Success, but!!! Using the manually mount command, I was able to mount "backupdisk1" (sda) without any problems.

    Code:
    # mount -t ntfs /dev/sda1 /media/backupdisk1

    Code:
    # mount
    /dev/md1 on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    /dev/sdb1 on /media/backupdisk2 type ext4 (rw,nosuid,nodev)
    /dev/sda1 on /media/backupdisk1 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
    

    Now all I need is to make the right line in "fstab"
    So now all I need is to understand how to setup this/these backup drives permissions. I'd like these 2 backupdrives to be accessible by the Samba server's user (which is me) and the root account of course. Here's a link to a site which describes this. And then nls=utf8 in US mode. How do I do that???:
    https://help.ubuntu.com/community/AutomaticallyMountPartitions

    NTFS partition* rw,auto,user,fmask=0111,dmask=0000 rw,user,auto,fmask=0177,dmask=0077,uid=1000


    *If you want write access to your file system, you should set the filesystem type to 'ntfs-3g' instead of 'ntfs'. You may need to install the package 'ntfs-3g' for this to work, so make sure it is installed before you use ntfs-3g.

    **uid=1000 restricts access to the user created while installing Ubuntu. 1001 is the user created after that, and so forth. gid=# may be used with or in place of uid to grant access to a group. However, group and user enumeration is beyond the scope of this article.



    So, if anyone know how to make this line right, please help. Actually I want both the root account and the "first account" after that, to be able to access the drives. And I think we better use the nls=utf8 too. I always choose "utf8=US" when installing the OS. Keep it english and then with a danish keyboard layout...

    1. So how do I do that ??? + utf8=US ???:

    <UUID> /media/backupdisk1 ntfs rw,user,auto,fmask=0177,dmask=0077,uid=1000 0 0
    or
    <UUID> /media/backupdisk1 ntfs-3g defaults,windows_names,locale=en_US.utf8 0 0
    or
    <UUID> /media/media/backupdisk1 ntfs defaults,uid=1000,rw 0 0


    2. And if I only want to be able to read from it???
     
    Last edited: Sep 29, 2014

Share This Page