Linux Block Device Notes

This is an old revision of the document!


Prev  
 Next

Linux Block Device Notes

Linux Disk Partition and Format Notes

Some basic tools

lsblk to list partitions (or list block devices) lsblk -f or blkid to list the UUIDs


parted

There would seem to be a number of partition tools for Linux CLI.
  • sudo parted -l - to see all available partition information
  • sudo parted /dev/sda - to partition the specific drive

When in parted:

  • print to see current partition information
  • mkpart help to list option
  • mklabel gpt to give drive label gpt
  • mkpart help mkpart to list specific help items on mkpart
  • mkpart primary ext4 0% 100% to make a partition that take the full optimised drive area
  • rm 1 to remove partition 1

Format

sudo mkfs.ext4 /dev/sda1 - to format the drive


Fstab

sudo vim /etc/fstab -to edit the boot disk mount table, remember to make matching mount point directories


mount

Local Device

mount -t ext2 /dev/sdb1 /run/media/diska

NFS Device

To mount a NFS manually:

  • sudo mount -t nfs -o rw,vers=4 192.168.1.5:/export/Disk1 /mnt/backup1
  • sudo mount -t nfs -o rw,vers=4 192.168.1.5:/export/Disk2 /mnt/backup2

Where:

  • -t nfs : type nfs
  • -o : options, options are separated by commas with no spaces
    • rw : read / write
    • vers=4 : version 4 of nfs
  • 192.168.1.5:/export/Disk1 is the remote exported NFS mount point
  • /mnt/backup1 : is the local mount point, note this directory must exist, ideally empty, any existing contents are usually invisible and otherwise ignored

unmount

sudo umount /run/media/diska


mount at boot

sudo vim /etc/fstab


Block Device Monitoring and Control

smartmon


hdparm


/app/www/public/data/attic/home_server/home_server_setup/other_services/disk.1598703682.txt.gz · Last modified: 2023-04-30 Sun wk17 17:44
CC Attribution-Share Alike 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International