{{tag>linux debian nfs parted fstab format partion disk mount umount fstab unmount}} =======Linux Block Device Notes====== =====Linux Disk Partition and Format Notes ===== ====Some basic tools==== *''ls -l /dev/disk/by-uuid/'' will list the disks with UUIDs *''lsblk'' to list partitions (or list block devices) *''lsblk -f'' or ''blkid'' to list the UUIDs *''sudo blkid'' will list data blocks ---- ====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 ext4 /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===== My main server has a parity disk that is normally only is used once a week. I would like to place this hard disk in to stand-by to reduce power and wear and tear upon it. ====smartmon==== * ''sudo smartctl -i -n standby /dev/sdb'' will chack the HD activity mode. It does this without starting up the drive, which hdparm may do. * If in standby mode it reports back only: "Device is in STANDBY mode, exit(2)" otherwise * ++ active or idel mode| smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.12.41+deb13-amd64] (local build) Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Western Digital Red Plus Device Model: WDC WD100EFAX-68LHPN0 Serial Number: xxxxxx LU WWN Device Id: xxxxxxxxx Firmware Version: 83.H0A83 User Capacity: 10,000,831,348,736 bytes [10.0 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 5400 rpm Form Factor: 3.5 inches Device is: In smartctl database 7.3/5804 ATA Version is: ACS-2, ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Sun Sep 14 11:21:22 2025 AWST SMART support is: Available - device has SMART capability. SMART support is: Enabled Power mode is: ACTIVE or IDLE ++ ---- ====hdparm==== *''sudo hdparm -y /dev/sdb'' sets the HD into standby mode To for the HD into standby mode after reboot and set the standby time crate and use an on boot systemd service. ++++/etc/systemd/system/hdparm.service| [Unit] Description=hdparm sleep [Service] Type=oneshot ExecStart=/usr/sbin/hdparm -q -S 120 -y /dev/sdb [Install] WantedBy=multi-user.target ++++ Some tips: *use ''whereis hdparm'' to confirm where the command is installed. *use ''sudo apt install hdparm'' to install if required *use ''sudo systemctl daemon-reload'' after modifying or creating a new systemd service to update systemd configuration *use ''sudo systemctl status hdparm.service'' to see status of service and enable if required. ====idle3-tools==== [[https://idle3-tools.sourceforge.net/|idle3-tools]] provides a linux/unix utility that can disable, get and set the value of the infamous idle3 timer found on recent Western Digital Hard Disk Drives. *[[https://man.archlinux.org/man/idle3ctl.8|IDLE3CTL(8)]] man page from Archlinux ====References==== *[[https://www.digitalocean.com/community/tutorials/how-to-partition-and-format-storage-devices-in-linux|How To Partition and Format Storage Devices in Linux]] ---- <- home_server:home_server_setup:other_services:ipmi_console|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:nfs|Next ->