Skip to content

Instantly share code, notes, and snippets.

@Suzhou65
Last active September 18, 2020 07:42
Show Gist options
  • Save Suzhou65/a68c44f343953fc245f6d4438cdbab77 to your computer and use it in GitHub Desktop.
Save Suzhou65/a68c44f343953fc245f6d4438cdbab77 to your computer and use it in GitHub Desktop.
Raspbian install Hentai@Home

Mount external hard drive

Check volume and available space

df -h 

List physical driver and volume

lsblk

Connect external hard drive to Raspberry Pi

After reboot

lsblk

It will show something just like this

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0  55.9G  0 disk 
└─sda1        8:1    0  55.9G  0 part
mmcblk0     179:0    0  14.9G  0 disk 
├─mmcblk0p1 179:1    0  41.8M  0 part
└─mmcblk0p2 179:2    0  14.8G  0 part /

Check physical driver and volume information

sudo fdisk -l 

It will show something just like this at the last chapter

Disk /dev/sda: 55.9 GiB, 60022480896 bytes, 117231408 sectors
Disk model: 2135            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x11451419

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1        2048 117231407 117231406  55.9G  7 HPFS/NTFS/exFAT

Delete existing partitions

sudo fdisk /dev/sda
  • Command [ d ]
    delete partition
  • Command [ w ]
    save change

Create new partition

sudo fdisk /dev/sda
  • Command [ n ]
    create partition
  • Command [ p ]
    choice primary partition
  • Command [ 1 ]
    create single partition
  • Command [ Enter ]
    default first sector
  • Command [ Enter ]
    default last sector
  • Command [ w ]
    save change

Format partition

Format the partition with the ext4 file system

sudo mkfs.ext4 /dev/sda1 

It will show something just like this at the last chapter

mke2fs 1.43.4 (31-Jan-2017)
Creating filesystem with 14653670 4k blocks and 3670016 inodes
Filesystem UUID: 74046714-8ce6-444b-b157-824aa0a0eaca
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

Mount external hard drive

Create folder

sudo mkdir /media/hd
sudo chmod 777 /media/hd

Check physical driver and volume UUID

sudo ls -lh /dev/disk/by-uuid

It will show something just like this

total 0
lrwxrwxrwx 1 root root 15 Aug 21 23:17 3961527c-ac15-44d4-8a19-dce4ffb0c47c -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Aug 21 23:17 cdf5-4176 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Aug 21 23:17 74046714-8ce6-444b-b157-824aa0a0eaca -> ../../sda1

Check external hard drive and volume UUID

sudo blkid /dev/sda1

It will show something just like this

/dev/sda1: UUID="74046714-8ce6-444b-b157-824aa0a0eaca" TYPE="ext4" PARTUUID="71ab09b5-01"

Editing fstab configuration file

sudo vim /etc/fstab

Add following configuration at the bottom of fstab

UUID=74046714-8ce6-444b-b157-824aa0a0eaca /media/hd ext4 defaults 0 2

It should be look like this

proc                  /proc           proc    defaults          0       0
PARTUUID=3961527c-01  /boot           vfat    defaults          0       2
PARTUUID=3961527c-02  /               ext4    defaults,noatime  0       1
UUID=74046714-8ce6-444b-b157-824aa0a0eaca /media/hd ext4 defaults 0 2
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off]  for that

After reboot, it will mount as folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment