Operation and Maintenance
Linux Operation and Maintenance
Formatting the Linux system partition of the Alibaba Cloud host and mounting the data diskFormatting the Linux system partition of the Alibaba Cloud host and mounting the data disk
In addition to the free system disk in Alibaba Cloud, the second cloud disk purchased is not automatically mounted by default and needs to be manually configured and mounted.
Use [Management Terminal] or remote connection tool, enter the user name root and password to log in to the Linux system.
1. Run the fdisk -l command to view the data disk. Before partitioning and formatting the data disk, you cannot see the data disk using the "df -h" command. You can use the "fdisk -l" command to view it.
After executing the command, if /dev/vdb does not exist, it means there is no data disk. Confirm whether the data disk is mounted.
2. Execute the following commands in sequence to create a single-partition data disk:
(1) Run fdisk -u /dev/vdb: partition data disk.
(2) Enter p: Check the partition status of the data disk. In this example, the data disk has no partitions.
(3) Enter n: Create a new partition.
(4) Enter p: Select the partition type as the primary partition.
Description In this example, a single-partition data disk is created, so only the primary partition needs to be created. If you want to create more than four partitions, you should create at least one extended partition, i.e. select e (extended).
(5) Enter the partition number and press Enter. In this example, only one partition is created, enter 1.
(6) Enter the first available sector number: press Enter to adopt the default value of 2048.
(7) Enter the last sector number: This example only creates one partition, press Enter to adopt the default value.
(8) Enter p: View the planned partitioning of the data disk.
(9) Enter w: start partitioning and exit after partitioning.
[root@ecshost~ ]# fdisk -u /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x3e60020e.
Command (m for help): p
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): p
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e
Device Boot Start End Blocks Id System
/dev/vdb1 2048 41943039 20970496 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.3. Run the command fdisk -lu /dev/vdb to view the new partition.
If the following information appears, it means that the new partition /dev/vdb1 is created successfully.
[root@ecshost~ ]# fdisk -lu /dev/vdb Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x3e60020e Device Boot Start End Blocks Id System /dev/vdb1 2048 41943039 20970496 83 Linux
4. Run the command mkfs.ext4 /dev/vdb1 to create a file system on the new partition.
In this example, create an ext4 file system. You can also choose to create other file systems according to your own needs. For example: if you need to share files between Linux, Windows and Mac systems, you can use mkfs.vfat to create a VFAT file system.
Note: The time required to create a file system depends on the size of the data disk.
[root@ecshost~ ]# mkfs.ext4 /dev/vdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1310720 inodes, 5242624 blocks 262131 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2153775104 160 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
5. (Recommended) Run the command cp /etc/fstab /etc/fstab.bak to back up the etc/fstab file.
6. Run the command echo /dev/vdb1 /data0 ext4 defaults 0 0 >> /etc/fstab to write new partition information to /etc/fstab.
Note: The Ubuntu 12.04 system does not support barriers. You need to run the command echo '/dev/vdb1 /data0 ext4 barrier=0 0 0' >> /etc/fstab.
If you want to mount the data disk to a folder separately, for example, to store web pages alone, replace /data0 in the command with the required mount point path.
7. Run the command cat /etc/fstab to view the new partition information in /etc/fstab.
[root@ecshost~ ]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Wed Dec 12 07:53:08 2018 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=d67c3b17-255b-4687-be04-f29190d37396 / ext4 defaults 1 1 /dev/vdb1 /mnt ext4 defaults 0 0
8. Run the command mount /dev/vdb1 /data0 to mount the file system.
9. Run the command df -h to check the current disk space and usage.
The information about the new file system appears, indicating that the mounting is successful.
<div><br class="Apple-interchange-newline">[root@ecshost~ ]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 1.6G 36G 5% / devtmpfs 234M 0 234M 0% /dev tmpfs 244M 0 244M 0% /dev/shm tmpfs 244M 484K 244M 1% /run tmpfs 244M 0 244M 0% /sys/fs/cgroup tmpfs 49M 0 49M 0% /run/user/0 /dev/vdb1 20G 45M 19G 1% /mnt</div> 12345678910 [root@ecshost~ ]# df -h Filesystem Size Used Avail Use% Mounted on/dev/vda1 40G 1.6G 36G 5% /devtmpfs 234M 0 234M 0% /devtmpfs 244M 0 244M 0% /dev/shmtmpfs 244M 484K 244M 1% /runtmpfs 244M 0 244M 0% /sys/fs/cgrouptmpfs 49M 0 49M 0% /run/user/0/dev/vdb1 20G 45M 19G 1% /mnt
10. Finally reboot, restart the server.
Recommended: "linux video tutorial"
The above is the detailed content of Formatting the Linux system partition of the Alibaba Cloud host and mounting the data disk. For more information, please follow other related articles on the PHP Chinese website!
Linux: A Look at Its Fundamental StructureApr 16, 2025 am 12:01 AMThe basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.
Linux Operations: System Administration and MaintenanceApr 15, 2025 am 12:10 AMThe key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.
Understanding Linux's Maintenance Mode: The EssentialsApr 14, 2025 am 12:04 AMLinux maintenance mode is entered by adding init=/bin/bash or single parameters at startup. 1. Enter maintenance mode: Edit the GRUB menu and add startup parameters. 2. Remount the file system to read and write mode: mount-oremount,rw/. 3. Repair the file system: Use the fsck command, such as fsck/dev/sda1. 4. Back up the data and operate with caution to avoid data loss.
How Debian improves Hadoop data processing speedApr 13, 2025 am 11:54 AMThis article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file
How to learn Debian syslogApr 13, 2025 am 11:51 AMThis guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud
How to choose Hadoop version in DebianApr 13, 2025 am 11:48 AMWhen choosing a Hadoop version suitable for Debian system, the following key factors need to be considered: 1. Stability and long-term support: For users who pursue stability and security, it is recommended to choose a Debian stable version, such as Debian11 (Bullseye). This version has been fully tested and has a support cycle of up to five years, which can ensure the stable operation of the system. 2. Package update speed: If you need to use the latest Hadoop features and features, you can consider Debian's unstable version (Sid). However, it should be noted that unstable versions may have compatibility issues and stability risks. 3. Community support and resources: Debian has huge community support, which can provide rich documentation and
TigerVNC share file method on DebianApr 13, 2025 am 11:45 AMThis article describes how to use TigerVNC to share files on Debian systems. You need to install the TigerVNC server first and then configure it. 1. Install the TigerVNC server and open the terminal. Update the software package list: sudoaptupdate to install TigerVNC server: sudoaptinstalltigervnc-standalone-servertigervnc-common 2. Configure TigerVNC server to set VNC server password: vncpasswd Start VNC server: vncserver:1-localhostno
Debian mail server firewall configuration tipsApr 13, 2025 am 11:42 AMConfiguring a Debian mail server's firewall is an important step in ensuring server security. The following are several commonly used firewall configuration methods, including the use of iptables and firewalld. Use iptables to configure firewall to install iptables (if not already installed): sudoapt-getupdatesudoapt-getinstalliptablesView current iptables rules: sudoiptables-L configuration


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment





