Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: How to mount an external drive on 20.04 ?

  1. #11
    Join Date
    Feb 2020
    Beans
    26

    Re: How to mount an external drive on 20.04 ?

    ... and there was me hoping there'd be a simple answer ! For anyone who'd read this post, I've made a major edit.
    My desktop which I simply updated is using LVM. The laptop which I installed from an iso has the dual Partition arrangement.
    How do I do an new install on the laptop and ensure it employs LVM ? I don't recall that being offered as an option.
    Thanks
    Last edited by sussexlad; 4 Weeks Ago at 10:53 AM.

  2. #12
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,800

    Re: How to mount an external drive on 20.04 ?

    How do I do an new install on the laptop and ensure it employs LVM ?
    I create the LVM physical volume, volume group and logical volume befure starting the installer if these don't already exist. That way you have control of the locations and sizes of these things.

    You use the 'Something Else' choice on the 'Installation Type' screen, which opens the partitioning screen. There you select the LV to be used for root of the OS.

    Gparted can create the LVM physical volume (Format the partition as LVM2). The result is also called an 'LVM partition'. The volume group (vg) and logical volumes (lv) are created on the LVM partitions with terminal commands - vgcreate and lvcreate.

    Before beginning, you need have a minimal understanding of what you are doing: a good introduction to LVM for beginners that I have used is:

    http://www.tutonics.com/2012/11/ubun...de-part-1.html

    Once you do an LVM installation, you have 'bought in' to using LVM and need to learn the basic maintenance commands.
    Last edited by Dennis N; 4 Weeks Ago at 12:06 PM.

  3. #13
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,619
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to mount an external drive on 20.04 ?

    Quote Originally Posted by sussexlad View Post
    ... and there was me hoping there'd be a simple answer ! For anyone who'd read this post, I've made a major edit.
    My desktop which I simply updated is using LVM. The laptop which I installed from an iso has the dual Partition arrangement.
    How do I do an new install on the laptop and ensure it employs LVM ? I don't recall that being offered as an option.
    Thanks
    There is an option to use LVM in the installer for most flavors of Ubuntu Desktop and Server. I suppose a few installers may not have that included. Usually, when LVM is selected during the install, it is part of the --wipe everything on disk first-- installation choice.

    Just to be clear, you already have an install with LVM on the internal disk, but want to do more installs onto external USB storage also using LVM? These USB devices aren't just to be used for data, but for other OS?

    LVM has a few limitations that aren't intuitively obvious. For example, VG names need to be unique between different VGs connected to the system. So, if you intend to have 2 Ubuntu-Mate installs on the same machine, the default VG names ... let me check that:
    Code:
    $ sudo vgs
      VG            #PV #LV #SN Attr   VSize  VFree
      vgubuntu-mate   2   3   0 wz--n- 39.49g 6.39g
    vgubuntu-mate cannot be used for the 2nd install. That's because the device mapper process creates device names for LVs based on the VG-LV names. For example:
    Code:
    $ sudo lvs
      LV     VG            Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      home   vgubuntu-mate -wi-ao---- 12.00g                                                    
      root   vgubuntu-mate -wi-ao---- 17.00g                                                    
      swap_1 vgubuntu-mate -wi-ao----  4.10g
    So, "home", "root", and "swap_1" cannot be used in 2 separate installs on the same machine.
    Code:
    $ ll /dev/mapper/
    total 0
    drwxr-xr-x  2 root root     120 Oct 24 09:26 ./
    drwxr-xr-x 20 root root    4140 Oct 25 01:15 ../
    crw-------  1 root root 10, 236 Oct 24 09:27 control
    lrwxrwxrwx  1 root root       7 Oct 25 07:54 vgubuntu--mate-home -> ../dm-2
    lrwxrwxrwx  1 root root       7 Oct 25 07:54 vgubuntu--mate-root -> ../dm-0
    lrwxrwxrwx  1 root root       7 Oct 25 07:54 vgubuntu--mate-swap_1 -> ../dm-1
    Those device names are used in the fstab to mount storage. An /etc/fstab:
    Code:
    /dev/vgubuntu-mate/root /       ext4    errors=remount-ro 0 1
    /dev/vgubuntu-mate/home /home   ext4    errors=remount-ro 0 1
    /dev/vgubuntu-mate/swap_1 none  swap    sw      0       0
    See the issue?

    So, the different flavors usually create a different VG name to get around this problem. I think the newer installer attempted to fix that as well by using really ugly names for the devices in the fstab. I found them too ugly and manually changed those devices back to something human readable:
    /dev/{vg-name}/{lv-name}. Personal preference.

    If you manually create VGs, it would be good to choose unique names across all your systems, since in the future you may need to connect a HDD/SSD to another system. VG name collision is a hassle.

  4. #14
    Join Date
    Feb 2020
    Beans
    26

    Re: How to mount an external drive on 20.04 ?

    Many thanks for all the helpful advice.
    I now have another problem, in that it looks as if the DVD drive on the laptop has packed up. I have a replacement on the way.
    I admit that I did not see or understand the LVM option on install and will choose that option once the drive is sorted.
    I'm just left then with the question, how do you make a external SSD mountable on a LVM setup ?

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,619
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to mount an external drive on 20.04 ?

    Quote Originally Posted by sussexlad View Post
    I'm just left then with the question, how do you make a external SSD mountable on a LVM setup ?
    External storage can use or not use LVM. It is up to you. For data-only, not an OS, there are reasons for both of those options. Or you could decide to use ZFS or one of the 20+ other solutions. Storage on Linux has lots and lots of options, depending on the need.

    But ... the simple answer is don't use LVM for just data storage unless you need snapshot support.
    To do that, do it like any other disk.

    1. Create a partition table on the whole disk, use GPT. gparted, fdisk, parted can all do this.
    2. Create at least 1 partition. gparted, fdisk, parted can all do this.
    3. If you use gparted, format the partition with ext4 as the file system.
    4. Give the file system a LABEL. again, gparted makes this easy.
    5. Don't forget to "Apply" your gparted changes.

    That's all the prep work.
    Now for the mounting. There are a number of methods:
    • sudo mount command from a terminal
    • modify the /etc/fstab
    • use autofs to mount the storage on-demand and umount it when it isn't used.

    The easy answer is to setup the fstab, but then the storage has to be there at boot and cannot be removed. I don't do that for USB or networked storage, since those connections can be flaky and disappear.
    Because you gave the file system a LABEL during the prep-work above, you can easily mount the storage using that unique LABEL in the fstab. Add a line like this:
    Code:
    LABEL={whatever-label-you used}    /media/{whatever-label-you used}   ext4 nofail,noatime,errors=remount-ro     0 2
    Use sudoedit /etc/fstab to safely edit the fstab. Add that line. The label you choose cannot have any spaces in the name.
    When done, run this command to force systemd to re-scan the fstab and the mount -a to mount all storage that is inside the fstab.
    Code:
    sudo systemctl daemon-reload
    sudo mount -a
    That should be it.

    gparted rocks. There are other tools, but they aren't nearly as capable. You may need to install gparted .... or not. It is worth having installed. I don't trust the gnome-disks app.

    If you want to use LVM, do all the prep-steps up to the point of formatting a file system. Then you'll want to follow an LVM guide. For an SSD, I'd recommend a few things to get flexibility and to drastically increase the SSD lifetime.
    Leave 20% of the total storage un-partitioned. This allows the SSD to have more storage space for wear leveling.
    Inside the partition, setup 1 VG, but only allocate the LV storage as needed for 1-3 months growth. Increasing LV sizes is trivial and easy while the file system is online. Decreasing an LV is an off-line operation and can require backup+wipe first. If you use LVM, then you'll likely want to also use LVM snapshots for backups. These are dynamic - create/delete - just during backups, so you'll likely want to limit the total allocated VG storage to 80-90% of the total available so 10-20% is available for those snapshot LVs.
    After you create the PV, VG, and any LVs you need, then you use mkfs to format the LV as desired with the filesystem you want. If you don't use ext4, then all sorts of LVM+ext4 features are not available. LVM and EXT4 are designed to be used together.

    So see the different commands for vg, lv, and pv stuff, use tab completion:
    pv{tab}{tab}
    vg{tab}{tab}
    lv{tab}{tab}
    Basically, each command work like this:
    create, convert, reduce or extend and finally remove.
    Code:
    $ pv{tab}{tab}
    pvchange   pvcreate   pvmove     pvresize   pvscan     
    pvck       pvdisplay  pvremove   pvs   
    $ vg{tab}{tab}
    vgcfgbackup    vgconvert      vgextend       vgmknodes      vgs
    vgcfgrestore   vgcreate       vgimport       vgreduce       vgscan
    vgchange       vgdisplay      vgimportclone  vgremove       vgsplit
    vgck           vgexport       vgmerge        vgrename
    and the same for LVs.

    sudo pvs, vgs, lvs are the overview commands for each LVM object type. The vgdisplay, lvdisplay, and pvdisplay commands aren't really needed anymore, unless you really need to see all the details. I haven't in years, but the detail are there if you like to look.

    LVs are treated just like partitions. They get file systems (mkfs on LVs is blazing fast compared to normal partitions). They get mounted. They get fsck'd.

    The manpages for each of these commands is really great, but you'll want a clear understanding of how each of the objects fit together. LVM does add some complexity, but that usually only matters about 5 minutes every 5-10 yrs. The rest of the time, will be spent being happy you used LVM and knowing that 5-10 seconds with an lvextend command can add storage where you need it, when you need it. No guessing 4 yrs ago which I promise you'll get wrong. I've been doing storage for 25+ yrs and have yet to guess correctly where I needed storage.

    Heck, on a fresh 20.04 install in June, I got the storage guess wrong. My desktop install had been using 25G total storage for about a decade, but after the 20.04 install where I gave it 30G, I found it was always running out of storage. LVM to the rescue.
    Code:
    $ sudo pvs
      PV         VG            Fmt  Attr PSize   PFree
      /dev/vda5  vgubuntu-mate lvm2 a--  <29.50g    0 
      /dev/vdb1  vgubuntu-mate lvm2 a--  <10.00g 6.39g
    $ sudo vgs
      VG            #PV #LV #SN Attr   VSize  VFree
      vgubuntu-mate   2   3   0 wz--n- 39.49g 6.39g
    $ sudo lvs
      LV     VG            Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      home   vgubuntu-mate -wi-ao---- 12.00g                                                    
      root   vgubuntu-mate -wi-ao---- 17.00g                                                    
      swap_1 vgubuntu-mate -wi-ao----  4.10g            
    
    $ df -hT
    Filesystem                      Type  Size  Used Avail Use% Mounted on
    /dev/mapper/vgubuntu--mate-root ext4   17G   10G  5.9G  63% /
    /dev/mapper/vgubuntu--mate-home ext4   12G  6.2G  5.0G  56% /home
    /dev/vda1                       vfat  511M  7.1M  504M   2% /boot/efi
    Can you see what I did? BTW, the system was active, booted, running, the entire time these changes were made.
    Last edited by TheFu; 3 Weeks Ago at 12:37 AM.

  6. #16
    Join Date
    Feb 2020
    Beans
    26

    Re: How to mount an external drive on 20.04 ?

    Hi and thank you for that comprehensive explanation which I've made a note of.

    I have Gparted installed and have used it in the past.
    My issue is that when I plug the SSD into a USB port
    #lsusb adds the following line to the list but the drive is not listed by Gparted and so I'm unable to make any changes to it.
    How do I get it to appear ? I'm sorry if I'm being thick !!

    Bus 003 Device 008: ID 11b0:6298 ATECH FLASH TECHNOLOGY SNA-DC/U

  7. #17
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,619
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to mount an external drive on 20.04 ?

    Search for the USB ID and linux to see if it is supported. It appears to be an extremely old drive, from 2012 timeframe or did I misread that?

    Try a different USB port. Use USB2, not USB3 ports. If it is using a USB-switch/hub, try connecting it directly.
    When you connect it, does dmesg -w show that physical connection?

    Do you have the drive externally powered? If not, hook up external power.

    There are all sorts of reasons for USB storage not to work.

    Please post both the command AND the output here. Also, use the advanced editor and the '#' around everything you copy/paste from the terminal. We call that "using code-tags." Do not edit or realign the output. See how my output above in columns is aligned nice? That's just code tags -copy/pasted into the editor here.

    Code:
    dmesg -w
    lsusb -t
    please.

  8. #18
    Join Date
    Feb 2020
    Beans
    26

    Re: How to mount an external drive on 20.04 ?

    This is the final message following plugging the additional usb drive in.

    #dmesg

    [11908.752514] usb 3-8: new high-speed USB device number 26 using xhci_hcd
    [11908.901437] usb 3-8: New USB device found, idVendor=11b0, idProduct=6298, bcdDevice= 1.14
    [11908.901443] usb 3-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [11908.901447] usb 3-8: Product: SNA-DC/U
    [11908.901450] usb 3-8: Manufacturer: Kingston
    [11908.901453] usb 3-8: SerialNumber: 303030303030303030374239
    [11908.903012] usb-storage 3-8:1.0: USB Mass Storage device detected
    [11908.903299] scsi host6: usb-storage 3-8:1.0
    [11910.056717] usb 3-8: reset high-speed USB device number 26 using xhci_hcd
    [11910.348776] usb 3-8: reset high-speed USB device number 26 using xhci_hcd
    [11910.640705] usb 3-8: reset high-speed USB device number 26 using xhci_hcd
    [11910.932781] usb 3-8: reset high-speed USB device number 26 using xhci_hcd

    #lsusb -t

    /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    |__ Port 8: Dev 29, If 0, Class=Mass Storage, Driver=usb-storage, 480M
    |__ Port 9: Dev 2, If 1, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 9: Dev 2, If 2, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 9: Dev 2, If 0, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 9: Dev 2, If 3, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 10: Dev 18, If 0, Class=Vendor Specific Class, Driver=, 480M
    |__ Port 11: Dev 4, If 1, Class=Vendor Specific Class, Driver=btusb, 12M
    |__ Port 11: Dev 4, If 2, Class=Vendor Specific Class, Driver=btusb, 12M
    |__ Port 11: Dev 4, If 0, Class=Vendor Specific Class, Driver=btusb, 12M
    |__ Port 11: Dev 4, If 3, Class=Application Specific Interface, Driver=, 12M
    |__ Port 12: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 12: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
    /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M


    This line has been added when the additional USB drive was plugged in

    |__ Port 8: Dev 29, If 0, Class=Mass Storage, Driver=usb-storage, 480M

    However it is not recognised by gparted, so I'm unable to do anything with it.
    I have other usb drives that I use for backup which are recognised.

    Thanks

  9. #19
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,619
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to mount an external drive on 20.04 ?

    Sorry, I wasn't clear.
    1. Code:
      dmesg -w
    2. plug in the storage device
    3. what are the new lines added?


    Also, whenever posting terminal output, it is helpful to use 'code tags' - that's in the advanced editor here - #. We are just used to seeing things that line up a specific way.

    A number of other suggestions were made. Please go through each of those and let us know what you did, what the result was. We cannot read your mind. Every unanswered question leaves doubts. If it were me, I'd have already used another system, copied all the files onto a newer SDHC or USB3 flash device and moved on. It isn't like USB2 devices are worth $3 anymore.

  10. #20
    Join Date
    Feb 2020
    Beans
    26

    Re: How to mount an external drive on 20.04 ?

    Ok to tidy this thread up there were two problems.... which is confusing to say the least !

    1 ) The stand-alone 2.5" housing I was using was faulty, despite appearing to power up OK.
    2) The PSU supplying my ALL IN 1 HDD dock was putting out 6v instead of 12v.

    Gparted now sees all my SSDs and I can format them etc.

    Thanks for all the advice, which prompted me to keep looking.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

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