{"id":636,"date":"2023-11-16T20:52:15","date_gmt":"2023-11-16T19:52:15","guid":{"rendered":"https:\/\/gilbert.busana.lu\/?p=636"},"modified":"2024-02-17T21:05:56","modified_gmt":"2024-02-17T20:05:56","slug":"disk-management-commands","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=636","title":{"rendered":"Disk management commands"},"content":{"rendered":"\n<p>List partitions and drives<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>lsblk<\/code><\/pre><\/div>\n\n\n\n<p>Manipulate partition or list them with:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>fdisk -l<\/code><\/pre><\/div>\n\n\n\n<p>Using the disk free command:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>df -h<\/code><\/pre><\/div>\n\n\n\n<p>Partition manager utility<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>parted -l<\/code><\/pre><\/div>\n\n\n\n<p>Get detailed info on hardware, memory, firmware, mainboard, bus<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>lshw<\/code><\/pre><\/div>\n\n\n\n<p>Relative to mounted drives:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>lshw -class disk<\/code><\/pre><\/div>\n\n\n\n<p>Get that information as html (JSON, XML) page:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>lshw -class disk -html<\/code><\/pre><\/div>\n\n\n\n<p>List disks by ID, label, UUID&#8230;:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>ls -l \/dev\/disk\/by-id\nls -l \/dev\/disk\/by-label\nls -l \/dev\/disk\/by-partlabel\nls -l \/dev\/disk\/by-partuuid\nls -l \/dev\/disk\/by-path\nls -l \/dev\/disk\/by-uuid<\/code><\/pre><\/div>\n\n\n\n<p>sfdisk utility for manipulating disk partitions. List block devices:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>fsdisk -l<\/code><\/pre><\/div>\n\n\n\n<p>source: <a href=\"https:\/\/learnubuntu.com\/list-drives\/\">https:\/\/learnubuntu.com\/list-drives\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Smart monitor tool<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>smartctl -a \/dev\/nvme0<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Mount a drive<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>mkdir \/media\/usbstick\nmount \/dev\/sdbX \/media\/usbstick<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Delete files<\/h2>\n\n\n\n<p>Delete all files in all folders starting with <em>2023<\/em> living in the current folder<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>rm -rf 2023*<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>List partitions and drives Manipulate partition or list them with: Using the disk free command: Partition manager utility Get detailed info on hardware, memory, firmware, mainboard, bus Relative to mounted drives: Get that information as html (JSON, XML) page: List disks by ID, label, UUID&#8230;: sfdisk utility for manipulating disk partitions. List block devices: source: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-636","post","type-post","status-publish","format-standard","hentry","category-cli"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=636"}],"version-history":[{"count":11,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions"}],"predecessor-version":[{"id":984,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions\/984"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}