Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: How to mount an external drive on 20.04 ?

  1. #1
    Join Date
    Feb 2020
    Beans
    29

    How to mount an external drive on 20.04 ?

    Hi.
    I'd like to format several SSDs but when plugging any of them into a usb port, they appear in lsusb but not lsblk so I don't know how to mount them, if that's what's required?
    What should they then ideally be formatted with, to suit a fresh Ubunto 20.04 install?
    I have installed it onto a spare laptop but the disc allocation seems bizarre, with both Extended Partition 2, sda2 occupying the same space as Filesystem Partition 5, sda5 !! Is that right because when I attempted to image the disk (using Image for Linux) it took forever, rather than the previous 5/6 minutes?
    TIA

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,690
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: How to mount an external drive on 20.04 ?

    Did you chose LVM or ZFS during the install?
    or encryption?

    Under the 40 year old DOS partitioning, a few hacks where created to allow more partitions than the limited 4 primary allowed.

    GPT removes those limitations, but certain install choices force the old method to be used.

    Anyways, please post the command AND output.
    Code:
    lsblk -e 7 -o name,size,type,fstype,mountpoint
    sudo fdisk -l
    Last edited by TheFu; October 24th, 2020 at 07:38 PM.

  3. #3
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,812

    Re: How to mount an external drive on 20.04 ?

    the disc allocation seems bizarre
    This is the default partition scheme in Ubuntu 20.04 when you install in BIOS mode and choose erase disk and install. It works, but is not the usual way it would be done by most users. Partition #2 is an extended partition, which is essentially a container for one or more logical partitions. Partition #5 is where your install will be done.

    Code:
    Disk /dev/vda: 21.5GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End     Size    Type      File system  Flags
     1      1049kB  538MB   537MB   primary   fat32        boot
     2      539MB   21.5GB  20.9GB  extended
     5      539MB   21.5GB  20.9GB  logical   ext4
    Formatting the USB drives is best done with the Linux partition editor gparted. It should detect your drives. You don't mount them when creating the partition table and partitions.

  4. #4
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to mount an external drive on 20.04 ?

    UEFI or BIOS systems for SSDs?
    If only Ubuntu use gpt either way. But for UEFI you need ESP and for BIOS you need bios_grub partitions.
    But you have to use MBR(msdos) if old system and you have to install Windows in old BIOS boot mode.
    Microsoft has required UEFI/gpt since 2012, so most hardware is now UEFI.

    My partitioning on SSD, but some data on HDD also.

    Code:
    fred@z170-focal-k:~$ lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,fsused,MODEL | egrep -v "^loop"
    nvme0n1                                 465.8G        Samsung SSD 970 EVO Plus 500GB 
    ├─nvme0n1p1 vfat   ESP_NVME  /boot/efi    512M  11.9M  
    ├─nvme0n1p2 ext4   focal_0               29.3G         
    ├─nvme0n1p3 ext4   focal_k   /           29.3G   8.2G  
    ├─nvme0n1p4 ext4                         29.3G         
    └─nvme0n1p5 ext4   nvme_data /mnt/data  195.3G 127.5G 
    
    
    On smaller drives gparted still defaults to MBR(msdos), you first need to change to gpt. Changing from MBR to gpt will erase all data, so if you have data, but sure to have good backups.
    With gparted select gpt under device, advanced over msdos(MBR) default partitioning before starting.
    or
    sudo parted /dev/sda mklabel gpt
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

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

    Re: How to mount an external drive on 20.04 ?

    If you selected LVM for 20.04, something like this will happen:

    Code:
    $ sudo fdisk -l
    Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 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
    Disklabel type: dos
    Disk identifier: 0xa55500b1
    
    Device     Boot   Start      End  Sectors  Size Id Type
    /dev/vda1  *       2048  1050623  1048576  512M  b W95 FAT32
    /dev/vda2       1052670 62912511 61859842 29.5G  5 Extended
    /dev/vda5       1052672 62912511 61859840 29.5G 8e Linux LVM
    • vda1 = Primary partition - only 4 primary partitions are allows, including 1 Extended Primary Partition.
    • vda2 = Primary extended partition
    • vda5 = Logical partition - logical partitions must fully fit inside the single, "Extended Partition", but there can be over 100 Logical partitions.


    Inside vda5, LVM has control. Unless you prove you are using LVM, I'd rather not go any farther into that hole.

    More data, if you like, but not really mandatory if you don't want deep details:

    WinXP didn't support GPT, at least not initially. Microsoft mandated GPT be used for all UEFI booting probably for simplicity, but Linux isn't that picky. It can boot legacy BIOS or UEFI from either MBR or GPT partitioned disks. This is one decision where I really can't fault Microsoft, at least for my needs. I don't duel or quad-boot, so there isn't any need to support older OSes on the same boot. If I need an older OS, I'll run it inside a virtual machine.

    GPT is better in many, many, ways, so supporting older methods is mainly a compatibility choice by the Linux guys. For example, over 100 Primary partitions can be created with GPT without the Some Linux distros still create MBR partition tables today on new HDD/SSD installs.

  6. #6
    Join Date
    Feb 2020
    Beans
    29

    Re: How to mount an external drive on 20.04 ?

    Quote Originally Posted by TheFu View Post
    Did you chose LVM or ZFS during the install?
    or encryption?

    Under the 40 year old DOS partitioning, a few hacks where created to allow more partitions than the limited 4 primary allowed.

    GPT removes those limitations, but certain install choices force the old method to be used.

    Anyways, please post the command AND output.
    Code:
    lsblk -e 7 -o name,size,type,fstype,mountpoint
    sudo fdisk -l
    This is with the external usb drive plugged in - this is not the laptop. I shouldn't have involved two things at once !
    lsusb adds the line

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

    Code:
    $ lsusb
    Bus 002 Device 002: ID 8087:8000 Intel Corp. 
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 8087:8008 Intel Corp. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 002: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
    Bus 003 Device 014: ID 11b0:6298 ATECH FLASH TECHNOLOGY SNA-DC/U
    Bus 003 Device 005: ID 046d:c31c Logitech, Inc. Keyboard K120
    Bus 003 Device 004: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth
    Bus 003 Device 003: ID 04a9:190e Canon, Inc. CanoScan LiDE 120
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Code:
    $ lsblk -e 7 -o name,size,type,fstype,mountpoint
    NAME                    SIZE TYPE FSTYPE      MOUNTPOINT
    sda                   232.9G disk             
    └─sda1                232.9G part LVM2_member 
      ├─ubuntu--vg-root   231.9G lvm  ext4        /
      └─ubuntu--vg-swap_1   980M lvm  swap        [SWAP]
    sr0                    1024M rom
    Code:
    $ sudo fdisk -l
    [sudo] password for andy: 
    Disk /dev/loop0: 9.7 MiB, 9506816 bytes, 18568 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 /dev/loop1: 9.7 MiB, 9510912 bytes, 18576 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 /dev/loop2: 97.72 MiB, 102445056 bytes, 200088 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 /dev/loop3: 97.76 MiB, 102486016 bytes, 200168 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 /dev/loop4: 49.8 MiB, 52203520 bytes, 101960 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 /dev/loop5: 2.17 MiB, 2273280 bytes, 4440 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 /dev/loop6: 290.45 MiB, 304545792 bytes, 594816 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 /dev/loop7: 217.92 MiB, 228478976 bytes, 446248 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 /dev/sda: 232.91 GiB, 250059350016 bytes, 488397168 sectors
    Disk model: Samsung SSD 860 
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x42df724b
    
    Device     Boot Start       End   Sectors   Size Id Type
    /dev/sda1  *     2048 488396799 488394752 232.9G 8e Linux LVM
    
    Disk /dev/mapper/ubuntu--vg-root: 231.95 GiB, 249028411392 bytes, 486383616 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 /dev/mapper/ubuntu--vg-swap_1: 980 MiB, 1027604480 bytes, 2007040 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 /dev/loop8: 62.9 MiB, 65105920 bytes, 127160 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 /dev/loop9: 2.17 MiB, 2273280 bytes, 4440 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 /dev/loop10: 55.33 MiB, 58007552 bytes, 113296 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 /dev/loop11: 96.92 MiB, 101605376 bytes, 198448 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 /dev/loop12: 290.98 MiB, 305086464 bytes, 595872 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 /dev/loop13: 96.92 MiB, 101605376 bytes, 198448 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 /dev/loop14: 255.58 MiB, 267980800 bytes, 523400 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 /dev/loop15: 289.8 MiB, 303853568 bytes, 593464 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 /dev/loop16: 50.69 MiB, 53133312 bytes, 103776 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 /dev/loop17: 290.59 MiB, 304689152 bytes, 595096 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 /dev/loop18: 54.84 MiB, 57479168 bytes, 112264 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 /dev/loop19: 54.98 MiB, 57626624 bytes, 112552 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 /dev/loop20: 255.6 MiB, 267997184 bytes, 523432 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 /dev/loop21: 260.73 MiB, 273375232 bytes, 533936 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
    Last edited by oldfred; October 24th, 2020 at 09:09 PM. Reason: please use code tags for long terminal output # icon in Advanced Editor

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

    Re: How to mount an external drive on 20.04 ?

    This install uses LVM.
    I use LVM almost everywhere.
    I don't know what your intention is. Could you please simplify down to 3rd grade sentences for what you need?

    a) all the "loop" stuff is useless. Ignore it. That's part of the new snap packages. It is never useful.
    b) LVM is great, but adds complexity. It is an install-time choice. If you don't want to learn LVM, backup your files and do a fresh install being careful not to choose LVM.
    c) If you are willing to learn LVM, know that there is no GUI for this. Everything to manage the LVs inside to VGs connected to the PVs is 100% CLI/terminal. PVs are usually tied to a partition. Those layers make to tremendous flexibility.

    The first LVM commands to learn are:
    Code:
    sudo lvs
    sudo vgs
    LVs can almost always be considered the same as a partition. File systems are placed onto an LV, just like a file system is placed onto a partition. fstab mounts use the LV device, just like they can use a partition device, except that LV devices do not change at boot. No need to use UUIDs.

    To learn more about LVM, there are a number of tutorials. LVM is the same on all linux distros, so any tutorial is fine.

  8. #8
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to mount an external drive on 20.04 ?

    I used # to add code tags to your terminal output.
    Also better to exclude loops as the are not really devices.
    Either just do not include in the copy, paste or:
    lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,fsused,MODEL | egrep -v "^loop"
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

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

    Re: How to mount an external drive on 20.04 ?

    Hey oldfred, the lsblk -e 7 blocks loop devices, but I don't know how to get them removed from fdisk -l, do you?

    If the OP just wants a normal USB data drive, life should be pretty easy.
    Doing an install to USB storage is something I don't do. The closest tool for that I know is mkusb.

  10. #10
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to mount an external drive on 20.04 ?

    I do not have any loop devices.
    In bootinfoscript, now mostly part of Boot-Repair they added this:
    Code:
    ## List of all hard drives ##
    All_Hard_Drives=$(ls /dev/hd[a-z] /dev/hd[a-z][a-z] /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/xvd[a-z] /dev/vd[a-z] /dev/vd[a-z][a-z] /dev/nvme[0-9]n[0-9] /dev/nvme[0-9]n[0-9][0-9] /dev/nvme[0-9][0-9]n[0-9] /dev/nvme[0-9][0-9]n[0-9][0-9] /dev/mmcblk[0-9] /dev/mmcblk[0-9][0-9] 2>> ${Trash});
    I tried adding nvme to fdisk & it did not work (missing -l on second entry)
    sudo fdisk -l /dev/sd[a-z] -l /dev/nvme[0-9]n[0-9]p[0-9]

    But this seemed to work. Probably need mmc & vd drives also.
    Code:
    fred@z170-focal-k:~$ sudo parted -l /dev/sd[a-z] /dev/nvme[0-9]n[0-9]p[0-9] 
    Model: ATA HGST HTS721010A9 (scsi) 
    Disk /dev/sda: 1000GB 
    Sector size (logical/physical): 512B/4096B 
    Partition Table: gpt 
    Disk Flags:  
    
    Number  Start   End     Size    File system     Name                  Flags 
     1      1049kB  536MB   535MB   fat32           EFI System Partition  boot, esp 
     8      537MB   26.8GB  26.2GB  ext4            groovy 
     9      26.8GB  52.5GB  25.8GB  ext4            groovy_k 
     2      52.5GB  85.0GB  32.5GB  ext4            bionic_b 
     5      85.0GB  118GB   32.5GB  ext4            focal_a 
     6      118GB   443GB   325GB   ext4            data 
     4      786GB   945GB   158GB   ext4            backup_b 
     3      945GB   998GB   53.5GB  ext4            ISO_b 
     7      998GB   1000GB  2202MB  linux-swap(v1)                        swap 
    
    
    Model: Samsung SSD 970 EVO Plus 500GB (nvme) 
    Disk /dev/nvme0n1: 500GB 
    Sector size (logical/physical): 512B/512B 
    Partition Table: gpt 
    Disk Flags:  
    
    Number  Start   End     Size    File system  Name       Flags 
     1      1049kB  538MB   537MB   fat32        esp_nvme   boot, esp 
     2      538MB   32.0GB  31.5GB  ext4         focal_0 
     3      32.0GB  63.5GB  31.5GB  ext4         focal_k 
     5      63.5GB  273GB   210GB   ext4         nvme_data 
     4      469GB   500GB   31.5GB  ext4
    
    

    Last edited by oldfred; October 25th, 2020 at 03:49 AM.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

Page 1 of 3 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
  •