Kylin Desktop System Add Hard Disk

Kylin Desktop System Add Hard Disk

  • prerequisite
  1. Logged in to the desktop system.
  2. The newly added hard disk has been connected to the motherboard of the machine.


  • Use a partition editor to partition the newly added hard drive.

Operation steps: Start menu, partition editor, enter the login password, and select the newly added hard disk.

  • Create a partition table.

Brand-new hard disks generally do not have partition table information, so we need to create a partition table before we can partition the hard disk.

Operation steps: device, create partition table.

Here we suggest that it is better to select the partition table type as gpt format for better compatibility.

  • create partition

Operation steps: Select the unallocated capacity, right-click, and select New.

Here we can adjust the partition size and file system format according to our own needs. I choose 10G and ext4 format here.

If you still want to continue creating partitions, continue to select the unallocated capacity and right-click to create a new one.

Here I have created two partitions, both of which are 10G in size.

  • Format the partition.

The created partition cannot be used directly and needs to be formatted.

Operation steps: select the created partition, right-click, format as, and select a format you want.

Then select Apply.

Wait for a while, it will prompt success.

At this point, the disk partition is completed, open the file manager and we can see the partition just divided.

So far, we have been able to use each partition of our newly added hard disk like a U SB flash drive. Double-click to mount it before each use, and then we can access data in it.

mount partition

Although we can already access data in each partition of the newly added hard disk, it is very troublesome to double-click to mount it every time, and this mount is temporary and not stable enough. Next, we will mount each partition to the specified directory to avoid the above problems.

  • View hard disk partition information.
kylin@kylin-vm:~/desktop $ lsblk
loop0    7:0    0  173M  0 loop /run/wine
sda      8:0    0   60G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0    1K  0 part 
├─sda5   8:5    0 23.1G  0 part /
├─sda6   8:6    0   16G  0 part 
├─sda7   8:7    0 15.4G  0 part /data
└─sda8   8:8    0  4.6G  0 part [SWAP]
sdb      8:16   0   20G  0 disk 
├─sdb1   8:17   0   10G  0 part 
└─sdb2   8:18   0   10G  0 part 
sr0     11:0    1 1024M  0 rom  
kylin@kylin-vm:~/desktop $ 

As you can see, sdb1 and sdb2 are the two partitions we just divided.

  • Create a mount directory

The number of directories we create should correspond to the number of partitions that need to be mounted. For example, I created two partitions above, so here I created two directories disk1 and disk2 under the root directory. Here you can adjust it according to your own needs, and the directory name can also be customized.

kylin@kylin-vm:~/desktop $ sudo mkdir /disk1 /disk2
[sudo] kylin Password for:
kylin@kylin-vm:~/desktop $ 
kylin@kylin-vm:~/desktop $ ls /
backup  bin  boot  cdrom  data  dev  disk1  disk2  etc  home  lib  lib32  lib64  libx32  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
kylin@kylin-vm:~/desktop $ 

  • View hard disk partition UUID
kylin@kylin-vm:~/desktop $ sudo blkid
/dev/sda8: LABEL="SWAP" UUID="7c024ea1-18b1-4806-9841-9bb329d73205" TYPE="swap" PARTUUID="b445dd3f-08"
/dev/sda5: LABEL="SYSROOT" UUID="61ce7343-44d0-48c6-8785-6f5bb5548a00" TYPE="ext4" PARTUUID="b445dd3f-05"
/dev/loop0: TYPE="squashfs"
/dev/sda1: LABEL="SYSBOOT" UUID="db551a82-f79f-4404-a428-dfbed82a0a80" TYPE="ext4" PARTUUID="b445dd3f-01"
/dev/sda6: LABEL="KYLIN-BACKUP" UUID="c5b1b634-cb16-4963-b6f6-01e8bcdc707e" TYPE="ext4" PARTUUID="b445dd3f-06"
/dev/sda7: LABEL="DATA" UUID="8975ac15-ab52-4411-813c-d9ede116953e" TYPE="ext4" PARTUUID="b445dd3f-07"
/dev/sdb1: UUID="dc4e5598-d587-4b5e-894b-b78d33a8e7dd" TYPE="ext4" PARTUUID="b178b33f-afb0-4635-92b8-361665995e78"
/dev/sdb2: UUID="fcd512c7-a0a7-4ccf-bada-8e304c878d67" TYPE="ext4" PARTUUID="b08f7d64-9a31-4f54-99cb-3e2987cbed11"
kylin@kylin-vm:~/desktop $ 

In the last two lines, you can see the UUID s corresponding to the sdb1 and sdb2 we divided.

  • edit /etc/fstab
vim /etc/fstab
  • Press "i" to enter edit mode, then move the cursor to the end and add the following.
UUID=dc4e5598-d587-4b5e-894b-b78d33a8e7dd /disk1      ext4 defaults,x-gvfs-show     0   0
UUID=fcd512c7-a0a7-4ccf-bada-8e304c878d67 /disk2      ext4 defaults,x-gvfs-show     0   0

The value after UUID here is the UUID value corresponding to sdb1 and sdb2 we found above.

  • Press "esc", then type ":wq", and finally press Enter.

  • Manual verification.

kylin@kylin-vm:~/desktop $ sudo mount -a
kylin@kylin-vm:~/desktop $ 

Open the file manager again, and we can see that all partitions of the newly added hard disk have been mounted.

set partition label

In the above file manager, the two partitions are the same size, it is difficult for us to distinguish them, and it is very unfriendly to use. We can set a volume label for each partition, which makes it easier to distinguish.

kylin@kylin-vm:~/desktop $ sudo e2label /dev/sdb1 "office"
kylin@kylin-vm:~/desktop $ sudo e2label /dev/sdb2 "document"
kylin@kylin-vm:~/desktop $ 

Tags: Linux Operation & Maintenance Ubuntu kylin

Posted by php? on Wed, 21 Dec 2022 07:51:44 +0300