X
X
X
X

Knowledge Base

HomepageKnowledge BaseProblem of Linuxubuntu server creates users and all...

ubuntu server creates users and allocates disk space

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 physical and logical sector size
-B, --protect-boot don't erase bootbits when create a new label
-c, --compatibility[=] mode is'dos' or'nondos' (default)
-L, --color[=] colorize output (auto, always or never)
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 recognize specified partition table type only
-u, --units[=] display units:'cylinders' or'sectors' (default)
-s, --getsz display device size in 512-byte sectors [DEPRECATED]
--bytes print SIZE in bytes rather than in human readable format

-C, --cylinders specify the number of cylinders
-H, --heads specify the number of heads
-S, --sectors specify the number of sectors per track

-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

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(318 times viewed / 0 people found it helpful)

Top