Linux server partition and mount

  • 2020-06-03 09:09:06
  • OfStack

Linux server partition and mount

Step 1: Create the directory


// Create a directory 
mkdir /uardata1 
mkdir /uardata2 
mkdir /uardata3 
mkdir /uardata4 
mkdir /uardata5 
mkdir /uardata6 
mkdir /uardata7 
mkdir /uardata8 
mkdir /uardata9 
mkdir /uardata10 

Step 2: Create partitions


echo 'y'|mkfs.ext4 /dev/sdb & 
echo 'y'|mkfs.ext4 /dev/sdc & 
echo 'y'|mkfs.ext4 /dev/sdd & 
echo 'y'|mkfs.ext4 /dev/sde & 
echo 'y'|mkfs.ext4 /dev/sdf & 
echo 'y'|mkfs.ext4 /dev/sdg & 
echo 'y'|mkfs.ext4 /dev/sdh & 
echo 'y'|mkfs.ext4 /dev/sdi & 
echo 'y'|mkfs.ext4 /dev/sdj & 
echo 'y'|mkfs.ext4 /dev/sdk & 

Step 3: Mount the partition

Note:

Mount is not allowed until the partition is complete


 Mount: 
mount /dev/sdb /uardata1 
mount /dev/sdc /uardata2 
mount /dev/sdd /uardata3 
mount /dev/sde /uardata4 
mount /dev/sdf /uardata5 
mount /dev/sdg /uardata6 
mount /dev/sdh /uardata7 
mount /dev/sdi /uardata8 
mount /dev/sdj /uardata9 
mount /dev/sdk /uardata10 

Step 4:


 The editor /etc/fstab 
/dev/sdb          /uardata1          ext4  defaults    1 2
/dev/sdc          /uardata2          ext4  defaults    1 2
/dev/sdd          /uardata3          ext4  defaults    1 2
/dev/sde          /uardata4          ext4  defaults    1 2
/dev/sdf          /uardata5          ext4  defaults    1 2
/dev/sdg          /uardata6          ext4  defaults    1 2
/dev/sdh          /uardata7          ext4  defaults    1 2
/dev/sdi          /uardata8          ext4  defaults    1 2
/dev/sdj          /uardata9          ext4  defaults    1 2
/dev/sdk          /uardata10         ext4  defaults    1 2

Problem: If a hard disk of the server is broken and needs to be replaced, the corresponding partition of that hard disk must be commented out in /etc/fstab first, otherwise the server cannot be started

The & # 8195; The & # 8195; Phenomenon: causes the system to be unable to start, the text has become readable permission, cannot modify.

The & # 8195; The & # 8195; Solutions:

Enter root single-user mode, mount the system as writable permission,


mount -o w /

2. linux mkfs


 Instructions: mkfs
 The access to  :  Superuser 
 use  : mkfs [-V] [-t fstype] [fs-options] filesys [blocks] [-L Lable]
 instructions   :   To establish  linux  File systems in specific  partition  on 
 parameter   : 
  device  :   Prepare the hard disk for inspection  partition , such as: /dev/sda1
  -V :  Detail display mode 
  -t :  Given the type of file system, Linux  The default value is  ext2
  -c :  Check the file system before making it partition  Is there a bad track 
  -l bad_blocks_file :  There will be bad tracks block Information is added to the  bad_blocks_file  inside 
  block :  For a given  block  The size of the 
  -L: To establish lable

2.2 Format file type


[root@chb chb]# mkfs.ext3  /dev/sda6     Note: Format the device into ext3 The file system 
[root@chb chb]# mkfs.ext4  /dev/sda6     Note: Format the device into ext4 The file system 
[root@chb chb]# mke2fs -j  /dev/sda6     Note: Format the device into ext3 The file system 
[root@chb chb]# mkfs.ext2 /dev/sda6      Note: Format the device into ext2 The file system 
[root@chb chb]# mke2fs  /dev/sda6      Note: Format the device into ext2 The file system  
[root@chb chb]# mkfs.reiserfs /dev/sda6    Note: Format the device into reiserfs The file system 
[root@chb chb]# mkfs.vfat  /dev/sda6     Note: Format the device into fat32 The file system 
[root@chb chb]# mkfs.msdos  /dev/sda6     Note: Format the device into fat16 The file system ,msdos The file system is fat16 ; 
[root@chb chb]# mkdosfs  /dev/sda6      Note: Format the device into fat16 File system, same as mkfs.msdos 


Thank you for reading, I hope to help you, thank you for your support to this site!


Related articles: