Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to mount BTRFS volume at start up?

  1. #1
    Join Date
    Sep 2013
    Location
    New York
    Posts
    198

    Question How to mount BTRFS volume at start up?

    Ok, I have been trying to make this work for the last 2 weeks on and off
    so far no luck despite many help posts found and tried.
    I have an OpenSuse 13.1 64 bit server install with LXDE + Xen + Samba
    boots from a BTRFS "/" 1TB disk BTRFS "/home" is on a second 1TB disk
    I have a 2TB HDD with single BTRFS partition setup (/dev/sdc1) with mount point as (/DataStore1)
    I also have 2x3TB HDD (/dev/sdd and /dev/sde ) that have multi-device BTRFS volume ,as DataStore2, setup on raw devices(no partitions predefined)
    manually I can mount any of this just fine but I want to mount them on boot as my samba setup to share them. and it is not working.

    #1. I am not sure if I mount them properly to begin with as I mount them in /media/dataStore###
    #2. how can I make them auto-mount on boot? right now my shares are empty, showing me that I am not mounting the media as each of this volumes have test data on them. I do not get any errors when try to access them from my winPC but no data is there either.

    I added them to fstub but it did nothing.

    any suggestions are welcome

    thank you.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,818

    Default Re: How to mount BTRFS volume at start up?

    Please show more computer evidence of what you are telling. Like fstab listings, partition tales and more you say you have, but you do not show.

    BTW, it is not recommended to go for yourself and create mountpoints (and then use them for mountiing) in /media. It is for the system (more precise the desktop mounts). Use /mnt instead (or of course any other placve that might seem logical to you).
    Henk van Velden

  3. #3
    Join Date
    Sep 2013
    Location
    New York
    Posts
    198

    Default Re: How to mount BTRFS volume at start up?

    [QUOTE=hcvv;2634998]Please show more computer evidence of what you are telling. Like fstab listings, partition tales and more you say you have, but you do not show.
    [\QUOTE]

    what evidence do you need? and on the same note why do I need to "show any evidence"? and evidence of what exactly ? I am not accusing anyone of anything. I am asking a question that I can not find a solution for.

    I am giving a lot of information that should be enough to give a suggestion or at least
    point me to the right direction. at the moment I do not have access to the machine to give a print out of fstab.

    as for partition tables :
    I have 5 HDD in the system. I originally planed to have a bootable BTRFS RAID1 configuration but it did not worked as I expected so scraped the plan
    here is my hardware and partitioning :

    SYSTEM DRIVES : split root"/" and "/home" partitions among 2 drives
    sda - 1TB WD drive
    |-> sda1 1TB BTRFS label <ROOT> mountpoint "/"

    sdb - 1TB WD drive
    |-> sdb1 1TB BTRFS label <HOME> mountpoint "/home"


    sdc 2TB hitachi drive
    |-> sdc1 2TB BTRFS label<DATA1> mountpoint "/DATASTORE1"

    -- this drives are setup from CLI as a BTRFS multidevice volume on raw devices no partitions defined, and appear empty from Yast/partitioner (Yast does not support multidevice BTRFS setup. single drive only). however "btrfs fi show" returns a 3TB BTRFS volume in RAID1 configration for Data and MetaData
    sdd - 3TB WD drive
    sde - 3TB WD drive

    code used to setup the 3TB
    Code:
     mkfs.btrfs  -m raid1 -d raid1 label MEDIA1  /dev/sdd /dev/sde
    this creates a single volume spread across 2 drives.



    Quote Originally Posted by hcvv View Post
    BTW, it is not recommended to go for yourself and create mountpoints (and then use them for mountiing) in /media. It is for the system (more precise the desktop mounts). Use /mnt instead (or of course any other placve that might seem logical to you).
    I have seen many examples where /media is used to create a mountpoints for drives that need to be mounted on startup by the system. I do not want to mount this manually I want to set it up and forget it untl I need to add more drives or such.

    I thought that "/mnt" was used for temporary mounting of devices and/or file systems not for permanent mounts.
    am I wrong in that assumptions?

    I am building a file server / VM server
    all data volumes, and the plan is to have at least 3 main data stores, will be shared via Samba to be accessible to any device on the network and any VM that needs it. (plan to build out a owncloud VM to share things over the Internet. maybe even use that as main share hub for everything.)

    so I want to automount all data volumes that I plan to be shareable on start up so samba can find them and present it as shares.

    can you suggest something constructive for this scenario?

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,818

    Default Re: How to mount BTRFS volume at start up?

    To make a simple ecample. I do not tell a long story about my partitioning if I want it to be seen by forum members, I do:
    Code:
    boven:~ # fdisk -l
    
    Disk /dev/sda: 320.1 GB, 320072933376 bytes, 625142448 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
    Disk label type: dos
    Disk identifier: 0x1549f232
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1              63     4209029     2104483+  82  Linux swap / Solaris
    /dev/sda2   *     4209030    46154744    20972857+  83  Linux
    /dev/sda3        46154745   240974999    97410127+  83  Linux
    /dev/sda4       240975000   625137344   192081172+   f  W95 Ext'd (LBA)
    /dev/sda5       240975063   282920714    20972826   83  Linux
    /dev/sda6       282920778   492633224   104856223+  83  Linux
    boven:~ #
    Including prompts, command and output. And then I can comment that I use /dev/sda2 for my root, etc., but I better show:
    Code:
    boven:~ # df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2        20G  5.3G   14G  29% /
    devtmpfs        987M   40K  987M   1% /dev
    tmpfs           999M  156K  999M   1% /dev/shm
    tmpfs           999M  3.4M  996M   1% /run
    tmpfs           999M     0  999M   0% /sys/fs/cgroup
    tmpfs           999M  3.4M  996M   1% /var/run
    tmpfs           999M  3.4M  996M   1% /var/lock
    /dev/sda5        20G  5.3G   14G  29% /mnt/B                                                           
    /dev/sda3        92G   52G   40G  57% /home
    /dev/sda6        99G   68G   26G  73% /mnt/B/home
    boven:~ #
    For setting mounts do be done at boot there is /etc/fstab. You can edit that manualy, but you can also use YaST > System > Partitioning. That does much more then partitioning alone and in this case the partitioning is allready done, so you only have to tell there where you want it mounted (YaST will even create the mount point for you).

    The story about /mnt being for "temporary" mounts is most probably because the mounts belonging to a system in it's day to day functioning all have their places where the system/architect/manager/administrator thinks they belong (e.g. for /home or /database or /home/henk/music, or ...). And the system administrator will then use /mnt during maintenance to temporary mounting file system that he is organising/copying/whatever.

    But there is a tendency to mount partitions on mount points in /mnt and then, when needed, use symbolic links from e.g. /home/henk/music to the mount point.

    /media is for what the end-user calls "media". Cds, DVDs, USB sticks, memory cards. All those devices that ar not permanent part of the system, but are spontanious connected by the end-user where that end-user expects them to become available for usage on his desktop.
    In some systems /media is even a tmpfs file system. That will clean it on a shutdown, which is good because sloppy media handling by end-users can leave old mount points there.

    And seeing things done does not contradict the fact that it is not recommended (at least by me).
    Last edited by hcvv; 04-Apr-2014 at 08:33.
    Henk van Velden

  5. #5
    Join Date
    Sep 2013
    Location
    New York
    Posts
    198

    Default Re: How to mount BTRFS volume at start up?

    so if I understand your point correctly,

    1. I should not be using /media to mount my data stores.
    2. I can create folder in "/" for example "/MyDataStoreMounts"
    and mount all my storage there. and this is proffered method
    3. I have seen some examples using something like "/mnt/mymount"
    should I do this instead of #2?

    as for [QUOTE] I do not tell a long story about my partitioning if I want it to be seen by forum members[\QUOTE]
    I do not have access to my server at the moment so I can not do fdisk or anything to provide the output from.

    as for using "Yast/partitioner" as I already point out it does not work with BTRFS multidevice setup.
    you can only work with single disk at a time. also it actually create a partition on the disk which at this time I am thinking is not a bad idea at all.
    I may just do that. create a partition on one of the 3TB disks in yast with a mount point and all and then just expand it onto second drive via CLI.
    it should setup auto-mount and all.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,818

    Default Re: How to mount BTRFS volume at start up?

    Indeed better not use /media.
    What you see doing others all different here is showing the fact that it is the system manage that decides. The one is as good as the other (though I would not use a strange name like that one with all the Caps in it).
    The idea behind mounting in Unix/Linux is that the user is not aware of it. Thus if /home is on a different disk (partition) or not does not matter. Same for /var or /tmp or /mnt/databases/byers-database or /home/<user>/Documents/thebookIamwriting or /srv/www.
    It is normaly the same place as where you would put that data if it wasn't on a separate partition.

    Names like mymount only hints to me that the administrator there does not understand this. Who' mount? Who is my? Unix/Linux is a multi-user system. The data is either for the system in general (for web-server, database, music/movies to be seen by all users, .......) or it is to be owned by a particular user and thus most likely mounted inside his home directory. In the last case, it is of course his/hers, no need to name it my....
    BTW in that last case, many prefer (attention: preference, no must) to mount in e.g. /mount/<user>music or /userdata/<usr>/music and then make a symbolic link from /home/<user>/music to it. More or less the same result.

    Variations are endless. But one should understand the idea behind Unix/Linux mounting in the one directory tree (other systems have the concept of more directory trees, don't let eralier experiences fool you).

    Almost the only place you should not use is /media or something in it. It is there for a soecial purpose.

    ---------------

    And we come back to your original problem. Can I compress your problem to:
    I can mount it.
    But I am not able to create an fstab entry to let that happen at boot.
    When that is correct, we come back to my earlier complaint. When you say you can mount it, that is story telling. Showing which is the statment you use is computer facts. And we have to start from that statement to navigate to a working fstab entry.

    We can realy not "guess" what you do. We have to see it to come as near as possible to the situation where we can look over your shoulder.
    Henk van Velden

  7. #7
    Join Date
    Sep 2013
    Location
    New York
    Posts
    198

    Default Re: How to mount BTRFS volume at start up?

    nice summary,

    so to answer you :
    when I say I can mount it, I mean
    if I open file manger or dolphin
    I see entries for the Datastore1(2TB drive)
    and entry for 2 3TB drives (some how the manager knows that my BTRFS volume spans on both drives as I see both drives referred to by volume label(in this case MEDIA1))
    if I click on any of the drivers it mounts and all data is visible to me at the time.
    I can click on any of the 2 3TB drives and that mounts the full BTRFS volume span on them.
    however a. it mounts as /user/uuid it is only visible from my session. can not share it. as it will unmount when I log out.

    now if I run
    Code:
     # mount  /dev/sdd  /media/DATASTORE2
    for example in terminal under root
    (which what I have been using so far and this is the path I used in my SAMBA share config.) the share is available and shareable until next reboot.
    I have added lines to fstab but they did not work.
    however I have found a recent post on this board that might solve the issue for me. it is for network drives mount but I believe it points to whats wrong with my fstab entires. I think I screwed up the entry format. will try to fix and if it works will close this thread.
    Last edited by hcvv; 04-Apr-2014 at 10:37. Reason: repaired CODE tag

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,818

    Default Re: How to mount BTRFS volume at start up?

    You do not add mount commands to your fstab. And the other entries there should have warned you that they are not mount commands.

    Read
    Code:
    man fstab
    The entry must be something like this:
    Code:
    /dev/sdd /media/DATASTORE2 btrfs defaults 1 2
    Try this. It could be that we have to use other options then defaults, but this is a good starting point.
    Henk van Velden

  9. #9
    Join Date
    Sep 2013
    Location
    New York
    Posts
    198

    Default Re: How to mount BTRFS volume at start up?

    Quote Originally Posted by hcvv View Post
    You do not add mount commands to your fstab. And the other entries there should have warned you that they are not mount commands.

    Read
    Code:
    man fstab
    The entry must be something like this:
    Code:
    /dev/sdd /media/DATASTORE2 btrfs defaults 1 2
    Try this. It could be that we have to use other options then defaults, but this is a good starting point.
    thanks,

    I think I figured out what the problem was. I had fixed the fstab and it looks like the mount survived the reboot. I will test some more during this week when I have some free time.
    I put mount by UUID in fstab (I know that you do not put mount command into fstab BTW).
    what happened was I used wrong UUID, I used UUID for the hard drive instead of file system. need to be careful when copy/paste stuff all over the place.

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How to mount BTRFS volume at start up?

    On 2014-04-04 17:06, vl1969 wrote:
    >
    > hcvv;2634998 Wrote:
    >> Please show more computer evidence of what you are telling. Like fstab
    >> listings, partition tales and more you say you have, but you do not
    >> show.

    >
    >
    > what evidence do you need? and on the same note why do I need to "show
    > any evidence"? and evidence of what exactly ? I am not accusing anyone
    > of anything. I am asking a question that I can not find a solution for.


    We are not accusing anyone :-)

    It is simply easier for us to interpret the output of some commands, and
    draw our own conclusions, than read a description which we may not
    understand, or which may be a biased interpretation of the facts.

    Thus, for instance, instead of replying to your first post, I delayed
    till seeing your answer to Henk. :-)

    So, for instance, I would like the output of this command:

    Code:
    
    > lsblk --output NAME,KNAME,SIZE,TYPE,MOUNTPOINT,LABEL,UUID,PARTLABEL,PARTUUID
    and the contents of fstab. It would also be usefult to see the output of
    the command "mount" after you mounted the thing in dolphin, to see how
    the system sees it.

    Finaly, please use code tags. The '#' button - for command outputs and
    listings See how


    --
    Cheers / Saludos,

    Carlos E. R.

    (from 13.1 x86_64 "Bottle" (Minas Tirith))

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •