linux partitioning, formatting, mounting storage volumes

linux docker vm
Post Reply
dev
Site Admin
Posts: 61
Joined: 09 Mar 2021, 17:52

linux partitioning, formatting, mounting storage volumes

Post by dev »

Linux Crash Course - Formatting & Mounting Storage Volumes
Linux Crash Course - The /etc/fstab file

lsblk
lsblk : list block devices, connected

PARTITIONING
fdisk
fdisk : manipulate disk partition table

Code: Select all

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table
FAST FORWARD:
selecting proper disk
sudo fdisk /dev/sdb

creating a new empty GPT partition table
Command (m for help): g
Created a new GPT disklabel (GUID: 2148CAF2-3A48-2940-A167-D09594947B4C).

creating new partition
Command (m for help): n

choosing how many partitions
Partition number (1-128, default 1):

selecting first sector of new partition
First sector (2048-1000215182, default 2048):

selecting last sector of new partition
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1000215182, default 1000215182):

Created a new partition 1 of type 'Linux filesystem' and of size 476,9 GiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y

The signature will be removed by a write command.

writing changes with w
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


FORMATTING
sudo mkfs.ext4 /dev/sdb1


MOUNTING
mount : list all mounted devices
mount | grep sdb

sudo cp /etc/fstab /etc/fstab.bak


blkid : locate/print block device attributes -> grab UUID

sudo nano /etc/fstab

Code: Select all

UUID=ef22abe5-3539-4ee3-9f09-e8f12dac7925 /mnt/cx400 ext4 defaults 0 0
Post Reply