Linux/Hard Drive Management: Difference between revisions

From Dev Wiki
Jump to navigation Jump to search
(Add label information)
(Create symlink info)
Line 4: Line 4:
GUI Hard Drive Management:
GUI Hard Drive Management:
* Use the <code>gparted</code> program.
* Use the <code>gparted</code> program.
Copy Files Locally:
* <code>dd if=<input_location> of=<output_location> status=progress conv=fsync</code>
Copy Files Over a Network:
* <code>rsync -avh <input_location> <output_location></code>
* Note that input/output locations can be a local file path or a network path. If it's a network path, then it takes the format of:
** <code><username>@<network_location>:<input_or_output_location></code>


Verifying a download against a hash:
Verifying a download against a hash:
Line 19: Line 11:


This should output a string, which you can directly compare to the string on the website. If they match, then the file is valid with no errors.
This should output a string, which you can directly compare to the string on the website. If they match, then the file is valid with no errors.
== File Management ==
=== Copying Files ===
Copy Files Locally:
dd if=<input_location> of=<output_location> status=progress conv=fsync
Copy Files Over a Network:
rsync -avh <input_location> <output_location>
Note that input/output locations can be a local file path or a network path. If it's a network path, then it takes the format of:
* <code><username>@<network_location>:<input_or_output_location></code>
=== Sym Links ===
ln -s <location_of_original_file_or_folder> <location_of_sym_link>
In this case, the <code><location_of_sym_link></code> will point to <code><location_of_original_file_or_folder></code>.


== View General Drive Info ==
== View General Drive Info ==

Revision as of 23:31, 22 March 2020

Various commands and tools to manage disks in Linux.

General

GUI Hard Drive Management:

  • Use the gparted program.

Verifying a download against a hash: Some large files (particularly iso/img files, such as for an OS install) will have an associated SHA256 string on the website download page.
To verify your download had no errors, you can run the command:

  • sha256sum <file_location>

This should output a string, which you can directly compare to the string on the website. If they match, then the file is valid with no errors.

File Management

Copying Files

Copy Files Locally:

dd if=<input_location> of=<output_location> status=progress conv=fsync

Copy Files Over a Network:

rsync -avh <input_location> <output_location>

Note that input/output locations can be a local file path or a network path. If it's a network path, then it takes the format of:

  • <username>@<network_location>:<input_or_output_location>

Sym Links

ln -s <location_of_original_file_or_folder> <location_of_sym_link>

In this case, the <location_of_sym_link> will point to <location_of_original_file_or_folder>.

View General Drive Info

For a simple overview, use:

  • lsblk

For more detail, use:

  • sudo fdisk -l

Change Label of Drive

The drive label is generally what an OS will automatically name the drive, upon mounting.
Thus, it can be useful to give your drive labels meaningful names.

For the following commands:

  • <partition> corresponds to the partition name (ex, sda1, sdb2, etc).
  • <label_name> corresponds to the new label you wish to give the drive.

Ext Partitions

e2label /dev/<partition> <label_name>

NTFS Partitions

ntsflabel /dev/<partition> <label_name>