Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

New Disk


20190118 Connecting a new disk to a computer may require the disk to be partitioned and then the partitions of the disks to be formatted before it can be used. The command cfdisk from the https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=util-linxutil-linx package can be used to partition a disk. Use mkfs.ext4 from https://packages.debian.org/search?suite=default&section=all&arch=any&searchon=names&keywords=e2fsprogse2fsprogs to format the disk:

  $ sudo cfdisk /dev/sdb
  $ sudo mkfs.ext4 /dev/sdb1

To give a partition a label that is visible to the operating system we can use e2label

  $ sudo e2label /dev/sdc1
  $ sudo e2label /dev/sdc1 frederick

The disk can then be mounted into the file system of the computer so that we can easily access its contents. A quick way to do so is to simply mount the device onto the temporary mount point:

  $ sudo mount /dev/sdb1 /mnt
  $ ls /mnt

To mount the disk on boot and into a fixed location we will give the disk a name, like sabrina, create a mount point for the disk

  $ sudo mkdir /media/sabrina

and add an entry into /etc/fstab.

UUID=767f41ad-5b32-310f-aa89-54a24e26687 /media/sabrian ext4 defaults,errors=remount-ro,noatime 0 0

The UUID comes from:

  $ sudo -i blkid | grep sdb1

We can manually mount the disk using:

  $ sudo mount /media/sabrina


Copyright © 1995-2019 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.