Mounting a new disk in Linux

sbalasa

Santhosh Balasa

Posted on May 31, 2021

Mounting a new disk in Linux

-> How to mount a new disk in Linux ?

#Create a partition
sudo fdisk /dev/sdb

#Verify using lsblk
sdb      8:16   0    2G  0 disk
└─sdb1   8:17   0    2G  0 part /

#Create a filesystem
sudo mkfs -t ext4 /dev/sdb1

#Mount it 
sudo mount -t ext4 /dev/sdb1 /kafka

#Verify using lsblk
sdb      8:16   0    2G  0 disk
└─sdb1   8:17   0    2G  0 part /kafka
Enter fullscreen mode Exit fullscreen mode

-> How to bind a folder to this new disk and keep its data ?

sudo mount -t ext4 /dev/sdc1 /obs_parser

#Bind
sudo mount -o bind /vagrant /obs_parser

#Edit /etc/fstab entry (optional)
/vagrant /obs_parser none defaults,bind 0 0

#lsblk
sdc      8:32   0   41G  0 disk
└─sdc1   8:33   0   41G  0 part /obs_parser
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
sbalasa
Santhosh Balasa

Posted on May 31, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related