How to add new drive to ubuntu

Step one: install drive

It’s easy…. 😉

Step two, check if drive is connected

sudo fdisk -l

Create partitions

sudo fdisk /dev/sdb

#Create partition
#----------------
#press u (units to sectors)
#press n (create new partition)
#press p (primary partition)
#press 1 (first partition)
#press enter (default start at begin)
#press enter (default end at end)

#Format partition
#----------------
#press L (list of formats)
#?? need tye 83, don't know how to enter ;-)

#press W (write changes to hdd and quit)

#update kernel with changes we have made
sudo partproble /dev/sdb

#format drive
sudo mkfs /dev/sdb1 -t ext4

#create directory mount point
sudo mkdir /home/dev/dev
sudo chmod 777 /home/dev/dev

#mount it
sudo mount /dev/sdb1 /home/dev/dev -t ext4

#try to write something
touch /home/dev/dev/test.txt
ls /home/dev/dev

#setup auto-mounting point
sudo nano /etc/fstab

#add line
/dev/sdb1 /home/dev/dev ext4 defaults 0 0

External ref:

Leave a Reply

Your email address will not be published. Required fields are marked *