ubuntu mount the new disk to the directory

Create a new partition

Environment (ubuntu18.04.4 vmware12) 

After all, you must create the disk you want to use a partition to mount a file system.

  I use a virtual machine directly to the original disk expansion 5G, so it is the original piece of the disk, the disk is / dev / sda, if a disk is new, it is probably / dev / sdb even / dev / sdd. . .

  Use fdisk -l to view the current regional situation:

 

 

 

 fdisk / dev / sda partition management input into the n (lowercase) to create a new partition

 

 Select e to create an extended partition, according to the area code has been good points increments created partition / dev / sda7

 Format / dev / sda7

 mkfs.ext4 / dev / sda7 formatted

Mount directory

Create a directory / media / var

mount /dev/sda7 /media/var

Backup / var directory

rsync -aqxP / var / * / media / was

mv / var /var.bak

Find sda7 partition uuid: blkid | grep sda7

 

vi /etc/fstab

Adding at the tail

UUID=586b0b86-f298-4b2a-943e-3e264cb922b4 /var ext4 defaults 0 2

Reboot the system

reboot

After the system up to look at:

 

 

sda7 has been mounted to var, in the data.

 

Guess you like

Origin www.cnblogs.com/liwutao/p/12443865.html