questions after reading a beginner's guide to btrfs

Discussion in 'HOWTO-Related Questions' started by commentator, Oct 18, 2015.

  1. commentator

    commentator Member

    I've a Raspberry PI running Raspbian with one harddisk with brtfs.
    it contains 2 subvols

    and they are mounted as:

    the top volume isn't mounted.

    As this disk is almost full I want to add an extra disk. Questions:
    1) how to add an extra disk? (every where it is mentioned to add it to mount but thats always for a volume without subvols and always with eg /dev/sda mounted, which isn't the case now)
    2) does it remember this extra disk after reboot or do I need to add something to fstab?
  2. boldbesusiax

    boldbesusiax New Member

    Howdy! There are several ways to solve a problem in *nix operating systems but if I understand your question correctly it sounds like you just need to partition a disk and plug it in and mount it.

    First you will need to run the command `sudo fdisk -l` (lowercase L) to view the current disks. Your first entry will start with `mmcblk` ignore that device, it is the SD card inserted into your RPi and take note of any subsequent drives (eg: sda sdb etc) your drive should appear as /dev/sda with partitions /dev/sda1 or /dev/sda5/6/7/etc. The second block device (sda) is your current harddrive and we dont want to touch it! Take caution.

    Second after you have identified your current disk you should insert your new disk, and run `sudo fdisk -l` as you did above to identify the disk you just added. Most modern disks will likely come pre-formatted, if you purchased it and will have a block device such as /dev/sdb1 already in it, being either NTFS or FAT32 depending on the size. If these filesystems are acceptable to you, you may use them as they are. (If you would like help formatting it to BTRFS or EXT4 just give the word, the only reason I leave it out is because formatting the wrong device can be catastrophic)

    Third, attempt to mount the new device with the command `mount /dev/sdb1 /media/tmp` replacing /dev/sdb1 with your device (you will need to create the directory /media/tmp) then type `sudo mount | grep sdb` (the | is SHIFT+\ on the keyboard and sdb will be the name of your device, yours will likely be different) to see what your device mounted as. Here is some sample output from one of my servers:

    /dev/sdc2 on / type ext2 (rw,noatime,errors=remount-ro)
    /dev/sdc1 on /boot type ext2 (rw,noatime)

    What you are looking for is the type (mine is EXT2, DO NOT USE EXT2!!!), this is the FS type you will set in your fstab file.

    Then you will need to edit /etc/fstab with your preferred editor, you can run `sudo gedit /etc/fstab` if you have gedit installed or you can use nano by calling `sudo nano /etc/fstab` and create an entry for the device. An entry to the fstab appears as: `/dev/sdb1 /mnt/storage vfat defaults 0 2` for example. Your names will be different but it is broken down to: (device|mount point|FS type|options|dump|pass). To attempt to mount the new drive issue the command `sudo mount -a` to automatically mount the new device and you should be golden, you will need to change the ownership or permissions of the mount point to ensure you may write to it but that is the easy part. To change the owner to your user issue the command `sudo chown pi:nobody /mnt/storage` for example.

Share This Page