Add a second harddrive - after reboot?

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

  1. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi,


    OS: Ubuntu Server 12.04.5 & RAID1 (Ubuntu Software RAID1)


    I've just made a clean installation of a Ubuntu Server 12.04. I'm building a fileserver and just ran into a problem.

    After connecting two new harddrives (used as backup drives) I made partitions and formatted one with the NTFS filesystem and the other with EXT4. I read that I now hav to "mount" the drives, but after reboot, this will be gone, right? I read that I had to edit "vi /etc/fstab" but what do I add to make these 2 new harddrives be accessible after reboot? The drives is called sda & sdb, and has 1 partition each (sda1 & sdb1)

    Looking forward to hear any suggestion ;)

    .
     
  2. srijan

    srijan New Member HowtoForge Supporter

    Yes.


    See as per your case it will

    Now in /etc/fstab entry must be like that

    where 100 will be your user id, i have taken just an example 1000
     
  3. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    UserID? rw,user,exec?

    Hi Srijan,



    I get it, but what does the argument "-p" do? ;)

    Great! This is one of the issues I couldn't find anywhere ;)
    But, there's always a but. What does this do? And why are they different?
    rw,user,exec
    defaults,uid=1000,rw

    What about the rights for the directory? Is this only if I'm mounting once??? And this ",rw "makes the directory/mount point accessible/readable!?
    Code:
    chmod 0777 /media/backup1

    Thanks for helping me, again :eek:
     
    Last edited: Sep 24, 2014
  4. srijan

    srijan New Member HowtoForge Supporter

    It means that we are telling mkdir command to create a directory in a parent directory. "-p" option can create a long parent directories.

    rw means read and write
    user means that the users will be able to mount the partitions and ‘nouser’ specifies that only root user can mount any partitions

    exec The option ‘exec’ specifies that the files residing in that device will be able to execute and ‘noexec’ remove the execute feature.

    defaults,uid=1000 The normal default for NTFS/ext4 file systems is equivalent to rw with the uid provided

    I prefer the default permissions, or for secured environment use

     
  5. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi Srijan,



    Thanks, because I'm pretty confused here. After being reading tutorials and manuals I'm more lost than found.

    Here's some samples:
    https://help.ubuntu.com/community/Fstab#Editing_fstab
    https://help.ubuntu.com/community/InstallingANewHardDrive

    /dev/sdc1 /media/drive ntfs-3g defaults,locale=en_US.utf8 0 0

    /dev/sdc1 /media/drive ext4 defaults 0 0

    /dev/sdc1 /media/drive vfat defaults 0 2


    My G.. !!!


    So, It's OK for me to use 1000 ;) Well, you know what I'm building and exactly what I'm trying to do, so I'll just do what you tell me to and go on with it ;) Thanks my friend ;)
     
    Last edited: Sep 24, 2014
  6. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi,


    Code:
    An error occurred while mounting /media/backupdisk1
    Any ideas why this error occurs? Backupdisk 1 is this one:

    From fstab:
    /dev/sda1 /media/backupdisk1 ntfs defaults,uid=1000,rw 0 0


    Code:
    # vi /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>
    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 defaults,uid=1000,rw  0       0
    /dev/sdb1 /media/backupdisk2 ext4 rw,user,exec  0       0

    Can it be because of the partition ID? That it's not the right one? 07, 86, 87?:
    http://www.howtoforge.com/forums/showthread.php?t=67028

    Device Boot Start End Blocks Id System
    /dev/sda1 2048 1953520064 976759008+ 83 Linux


    Some additional info:
    Code:
    # lshw -C disk
      *-disk
           description: ATA Disk
           product: WDC WD10EZEX-08M
           vendor: Western Digital
           physical id: 0.0.0
           bus info: scsi@0:0.0.0
           logical name: /dev/sda
           version: 01.0
           serial: WD-WCC3F5688801
           size: 931GiB (1TB)
           capabilities: partitioned partitioned:dos
           configuration: ansiversion=5 signature=00066956
      *-disk
           description: ATA Disk
           product: WDC WD10EZEX-08M
           vendor: Western Digital
           physical id: 0.0.0
           bus info: scsi@1:0.0.0
           logical name: /dev/sdb
           version: 01.0
           serial: WD-WCC3F5687943
           size: 931GiB (1TB)
           capabilities: partitioned partitioned:dos
           configuration: ansiversion=5 signature=000a01de
      *-disk
           description: ATA Disk
           product: WDC WD20EFRX-68E
           vendor: Western Digital
           physical id: 0.0.0
           bus info: scsi@2:0.0.0
           logical name: /dev/sdc
           version: 80.0
           serial: WD-WCC4M8ETLKZ1
           size: 1863GiB (2TB)
           capabilities: partitioned partitioned:dos
           configuration: ansiversion=5 signature=0003b949
      *-disk
           description: ATA Disk
           product: WDC WD20EFRX-68E
           vendor: Western Digital
           physical id: 0.0.0
           bus info: scsi@3:0.0.0
           logical name: /dev/sdd
           version: 82.0
           serial: WD-WCC4M8NXCX42
           size: 1863GiB (2TB)
           capabilities: partitioned partitioned:dos
           configuration: ansiversion=5 signature=0001a342
    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)
    Code:
    # blkid
    /dev/sdb1: UUID="8696fa40-c4df-4fdc-9f97-b361fc5ce09a" TYPE="ext4"
    /dev/sdc1: UUID="3b140885-c51a-dadc-2a25-4c3707d07dfe" UUID_SUB="cfc1ac9c-da51-82bc-a124-4995fc7adf2d" LABEL="whitley:0" TYPE="linux_raid_member"
    /dev/sdc2: UUID="b400ee33-6ebb-4f32-18bd-e49262934e66" UUID_SUB="e6353303-6ee8-1fe3-3766-94ef0c448ec5" LABEL="whitley:1" TYPE="linux_raid_member"
    /dev/sdd1: UUID="3b140885-c51a-dadc-2a25-4c3707d07dfe" UUID_SUB="f533f6ed-2c2b-05c0-745a-018a5d56a5df" LABEL="whitley:0" TYPE="linux_raid_member"
    /dev/sdd2: UUID="b400ee33-6ebb-4f32-18bd-e49262934e66" UUID_SUB="d99969e0-98ad-e3d9-c369-a15b7706c2bc" LABEL="whitley:1" TYPE="linux_raid_member"
    /dev/md0: UUID="66761273-d381-47fd-ba8a-9f6b4b41c6b2" TYPE="swap"
    /dev/md1: UUID="e1c18cc4-dd50-4ceb-b5ca-1b2f6e843302" TYPE="ext4"
    Code:
    # ls /dev/sd*
    /dev/sda   /dev/sdb   /dev/sdc   /dev/sdc2  /dev/sdd1
    /dev/sda1  /dev/sdb1  /dev/sdc1  /dev/sdd   /dev/sdd2
    BackUp Disks 1 & 2:
    /dev/sda partition: /dev/sda1
    /dev/sdb partition: /dev/sdb1

    RAID1:
    /dev/sdc partition: /dev/sdc1 /dev/sdc2
    /dev/sdd partition: /dev/sdd1 /dev/sdd2

    It should all be there !?!?




    .
     
    Last edited: Sep 25, 2014
  7. srijan

    srijan New Member HowtoForge Supporter

    Hi Dan,

    Change the NTFS /etc/fstab entry as

    I just created a NTFS drive in my machine and then mounted my Ubuntu with the above command, it is working perfectly. I checked it after reboot also.



    No it is not a good idea to add the partition number.
     
  8. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    HI srijan,


    Thanks, I'll try it right away.. It's irritating, because I'm working on the servers from elsewhere/SSH and can't "press S" to ignore mounting error ;)



    Do you mean the ID??? partition ID?? If, thanks for that, I've been trying to solve that issue for hours ;)

    I'll report back ;)



    BTW, whats the problem with this "/dev/sda1 /media/backupdisk1 ntfs defaults,uid=1000,rw 0 0" ???

    Actually I think I saw "4096" reported after trying to re-partition and format the drive! standard block size or something like that, can't remember...
    Regarding user rights, It's going to be a fileserver using SAMBA. I'll create a user, user rights accordingly. The NTFS partition and the EXT4 partition on the 2 backupdrives are only being accessed by the system, but I have to be able to access the data from the NTFS partition from a windows rig and the EXT4 partition from a Linux rig in case of total RAID brakedown (RAID-the other 2 drives). And since I don't know what I'm doing, I have to ask what we'll do about the user rights on these 2 backupdisks. I guess it has to do with "rw,nosuid,nodev,allow_other,default_permissions,bl" ;)




    .
     
    Last edited: Sep 26, 2014
  9. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Sos

    Hi Srijan,


    No luck! I corrected the input, but it will still not mount the drive. As you could see in my post from yesterday, it mounts backupdisk 2 just fine, so it must have to do with this fstab line. Or what do you think???

    :eek:
     
  10. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi Srijan,


    Solved the problem... The drive can now mount manually. Now I really need to find the right lines/permissions for both filesystems/backupdrives.

    backupdisk1 ntfs, here I need to make a line which allows root to be able to access files. But I'm not sure how these things work. System has to be able to make backups of course. But user/users of the fileserver don't really need to be able to write to these drives, right? Wouldn't it be better to allow root to be able to read the backups and maybe write as well, and no other!? What would you do???

    Can you help me find the right way to do this by discussing it here with me?

    Let's make it the same for both backup drives, since the 2 drives is just double safety. So I wan't both drives (backupdisk1/backupdisk2) to have the same user rights. Thanks in advance ;)

    This is how the permissions is after using this line in "fstab":
    /dev/sda1 /media/media/backupdisk1 ntfs defaults,uid=1000,rw 0 0

    Code:
    # mount
    /dev/sda1 on /media/backupdisk1 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
    /dev/sdb1 on /media/backupdisk2 type ext4 (rw,nosuid,nodev)
     
    Last edited: Sep 29, 2014
  11. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Permissions / fstab

    Hi,

    I've written one thing in fstab, but the output shows something else. Is this just the system "printing" the info in another way (means same thing??)

    I've written this line in fstab:
    /dev/sda1 /media/backupdisk1 ntfs defaults,uid=1000,rw 0 0

    /
    But the output is:
    /dev/sda1 on /media/backupdisk1 type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
     

Share This Page