Modify the hard disk name and boot-mounted hard disk under ubuntu

Modify the hard disk name and boot-mounted hard disk under ubuntu

1. View information

Check the volume label and uuid of all hard disk partitions on the computer,

sudo blkid

/dev/sda1: LABEL="win7" UUID="40305E93305E9030" TYPE="ntfs"
/dev/sda5: LABEL="software" UUID="823E2D6213AF89BD" TYPE="ntfs"
/dev/sdb1: LABEL="learning" UUID="CCBC9A082598C349" TYPE="ntfs"
/dev/sdb2: LABEL="datadisk" UUID="40e93235-b5d1-48c4-936c-212029bda05a" TYPE="ext4"
/dev/sdc1: UUID="7350922f-c69c-4f33-84e0-befd8b42d2f6" TYPE="swap"
/dev/sdd1: UUID="3002feb1-dceb-441d-bfd2-31243e336d39" TYPE="ext4"、
  • #In order to better distinguish the hard disk partitions, modify the volume label (similar to Windows C, D, E, F disk)
sudo e2label /dev/sdb2 data
  • 2. Mount processing

View the hard disk number to be mounted

df -h

# 以下只显示常用的
Filesystem      Size  Used Avail Use% Mounted on
tmpfs            13G   19M   13G   1% /run
/dev/sda3       113G   14G   94G  13% /
/dev/sda1       453M  141M  286M  33% /boot
/dev/sda4       479G   43G  422G   7% /home
/dev/sdb1       7.3T  729G  6.2T  11% /home/data
  •  

If it /dev/sdb1is what we want to mount (shown under mounted on here, I have processed it and put it in /home/data)

Then, pop up the partition whose name you want to modify,

sudo umount /dev/sdb2
  • Mount the hard drive
sudo mount /dev/sdb2  /home/data
  • 3. Modify auto mount

The partition is automatically mounted after the system restarts

sudo vim /etc/fstab
  •  

Add in the last line

/dev/sdb2  /home/data ext4 defaults 0 1

# or
# 编号,查看第一步
UUID="40e93235-b5d1-48c4-936c-212029bda05a" /home/data ext4 defaults 0 1
  •  

4. Hard disk permission settings

Modify the folder permissions to other users, avoid using it sudoto modify the files in the hard disk

sudo chown -R 你的用户名 /home/data
sudo chmod 777 /home/data

# or 
sudo chome -R 775 /home/data

Guess you like

Origin blog.csdn.net/yxpandjay/article/details/109529105