Create user
sudo adduser test //create
sudo adduser test sudo //Give the newly created user root privileges (optional)
sudo smbpasswd -a test //Create a samba user, which can facilitate windows access
Allocate disk space for users
Use the fdisk command to partition the disk, the following are the relevant parameters:
Options:
-b, --sector-size
-B, --protect-boot don't erase bootbits when create a new label
-c, --compatibility[=
-L, --color[=
colors are enabled by default
-l, --list display partitions end exit //list all disk space in the current system
-o, --output output columns
-t, --type
-u, --units[=
-s, --getsz display device size in 512-byte sectors [DEPRECATED]
--bytes print SIZE in bytes rather than in human readable format
-C, --cylinders
-H, --heads
-S, --sectors
-h, --help display this help and exit
-V, --version output version information and exit
1. Select the disk to be partitioned, and Li Yong command sudo fdisk -l to view
Here we choose the disk /dev/sda partition. From the above figure, we can see that the disk has been divided into two partitions.
2. Disk partition
sudo fdisk /dev/sda
Select parameter n, create a new partition
Here, select the appropriate partition size, here is divided into 40G, K is KB, M is MB, G is GB, T is TB, and P is PB.
3. Format the partition
4. Mount the partition to the user
sudo mount -t ext4 /dev/sda3/ /home/test
Use the df -h command to view the mounting situation
Finally, in order to automatically mount the partition at boot, you need to add a mount record in /etc/fstab
echo "/dev/sda3 /home/test ext4 defaults 0 2 ">> /etc/fstab