分类 Miscellaneous 中的文章

Mounting an External Hard Drive in Linux

After a machine restart, the external hard drive wasn’t recognized and needed to be remounted. However, after using fdisk -l, the external hard drive was nowhere to be found, making it impossible to mount.

Mounting an External Hard Drive in Linux

How to Mount a Disk

First, use fdisk -l to check the current hard drive status.

    ➜  ~ fdisk -l 
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

    Disk /dev/sdb: 320.1 GB, 320072933376 bytes, 625142448 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: gpt
    Disk identifier: AF1B577B-830C-4026-AC5F-37870D362B3C

    #         Start         End    Size  Type            Name
    1          2048      411647    200M  EFI System      EFI System Partition
    2        411648     2508799      1G  Microsoft basic
    3       2508800   625141759  296.9G  Linux LVM

    Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/mapper/centos-swap: 3623 MB, 3623878656 bytes, 7077888 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/mapper/centos-home: 261.5 GB, 261468717056 bytes, 510681088 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk /dev/sda: 1000.2 GB, 1000170586112 bytes, 1953458176 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x16f2a91f

          Device Boot      Start        End    Blocks  Id  System
    /dev/sda1             1 4294967295 2147483647+ ee  GPT

Here, my external hard drive is 1TB, which means it’s /dev/sda1. So, I can use the mount command to mount it:

……

阅读全文

Five Easy Steps to Achieve Linux Passwordless Login

SSH, which stands for Secure Shell, is a widely used and reliable program for securely executing commands remotely on Linux systems. SCP, used for secure file transfers, is also based on the SSH security protocol.

When you have many servers, frequently typing passwords can be quite troublesome. So, how can you log in without a password while maintaining security? Of course, it’s possible. Here, we’ll outline five steps to achieve passwordless login for Linux servers such as RHEL/CentOS 7.x/6.x/5.x and Fedora.

Five Easy Steps to Achieve Linux Passwordless Login

Let’s look at the environment:

    SSH Client : 192.168.1.12 ( Mac )
    SSH Remote Host : 192.168.1.11 ( CentOS 7 )

This article will demonstrate passwordless login from a Mac to a remote CentOS 7 server.

1. Generate SSH-Keygen Key Pair on Your Local Mac

First, use the following command in your Mac terminal to generate a key pair:

……

阅读全文

Detailed Explanation of Python Magic Methods

What are magic methods? Of course, they have nothing to do with magicians. They are everywhere in object-oriented Python. They are special methods that allow you to add “magic” to your classes. These methods are automatically called during certain operations and represent the wisdom of Python’s object-oriented design.……

阅读全文

boxes: An Interesting Command-Line String Shaping Tool

When frequently using GitHub, you may notice others’ repository code help information or website source code always has beautifully shaped patterns made of strings, but your own code lacks these decorations and looks plain. So how can you generate such stylish string shapes? The answer is to use the interesting command-line string shaping tool boxes.……

阅读全文

Python Random Strong Password Generator

Due to security needs, it is recommended that users use different strong passwords on different websites. Setting a strong password every time can be troublesome, so here we write a small Python program to generate strong passwords. In the future, just visit the following website and copy-paste the password.……

阅读全文

Setting up TensorFlow Deep Learning Server Environment

The lab just got a new server configured with an NVIDIA 1080TI graphics card for deep learning. The first thing after setting up the machine was figuring out how to configure the TensorFlow deep learning environment. Here, I’ll document my process of setting up the environment and the issues I encountered, hoping to help others with similar needs.……

阅读全文

Setting Python 3 as the Default Environment in Baota Panel

Baota Panel is a management panel that simplifies server administration via a web interface, boosting operational efficiency. It enables easy installation of essential web programs, website creation and management, FTP, database tools, a visual file manager, CPU, memory, and traffic monitoring charts, and scheduled tasks.……

阅读全文