Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Find all the available mountable file drives on your system:

sudo fdisk -l

output:

Disk /dev/ram0: 8 MiB, 8388608 bytes, 16384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Device             Start      End  Sectors   Size Type
/dev/mmcblk0p1        40 58720295 58720256    28G Microsoft basic data

Disk /dev/mmcblk0boot1: 8 MiB, 8388608 bytes, 16384 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/nvme0n1: 953.9 GiB, 1024209543168 bytes, 2000409264 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/zram0: 2 GiB, 2073931776 bytes, 506331 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Look for your HDD based on Disk size (probably in GiB's) in our case it's:

  • /dev/nvme0n1

    Disk /dev/nvme0n1: 953.9 GiB, 1024209543168 bytes, 2000409264 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
    

Now create a mount point where you want to attach your hdd on the system

sudo mkdir /media/LFS
sudo chmod 777 /media/LFS

Now we have to edit /etc/fstab so that it auto mounts the hdd on boot

sudo vim /etc/fstab

Edit the file and add a new line

# <file system> <mount point>         <type>          <options>      <dump> <pass>
/dev/sda        /media/LFS             ext4           defaults            0 1

And finally to mount the device run the below command

sudo mount -a

To see the available mounted device use command: df -H

Output:

/dev/mmcblk0p1   30G   12G   17G  42% /
none            4.1G     0  4.1G   0% /dev
tmpfs           4.2G   39M  4.1G   1% /dev/shm
tmpfs           4.2G   39M  4.1G   1% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
tmpfs           4.2G     0  4.2G   0% /sys/fs/cgroup
tmpfs           824M   13k  824M   1% /run/user/120
tmpfs           824M  127k  824M   1% /run/user/1000
/dev/sda        985G   18G  917G   2% /media/LFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment