Tạo và Mount disk vào Ubuntu

Chủ nhật - 09/04/2023 09:21 149 0
Hướng dẫn tạo và mount 1 disk mới vào Ubuntu
Tạo và Mount disk vào Ubuntu
root@hosting01:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.4M 1 loop /snap/core18/1944
loop1 7:1 0 69.9M 1 loop /snap/lxd/19188
loop2 7:2 0 31.1M 1 loop /snap/snapd/10707
sda 8:0 0 300G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
├─sda3 8:3 0 18G 0 part [SWAP]
└─sda4 8:4 0 280G 0 part /
sdb 8:16 0 1T 0 disk
sr0 11:0 1 1024M 0 rom
 
root@hosting01:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x9246e1d7.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-2147483647, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2147483647, default 2147483647):

Created a new partition 1 of type 'Linux' and of size 1024 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
 
root@hosting01:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.4M 1 loop /snap/core18/1944
loop1 7:1 0 69.9M 1 loop /snap/lxd/19188
loop2 7:2 0 31.1M 1 loop /snap/snapd/10707
sda 8:0 0 300G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
├─sda3 8:3 0 18G 0 part [SWAP]
└─sda4 8:4 0 280G 0 part /
sdb 8:16 0 1T 0 disk
└─sdb1 8:17 0 1024G 0 part
sr0 11:0 1 1024M 0 rom
root@hosting01:~#
 
root@hosting01:~# mkfs.ext4 /dev/sdb1
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 268435200 4k blocks and 67108864 inodes
Filesystem UUID: d0b897af-f983-4c8e-aafc-297b2820d3bb
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848


Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
 
root@hosting01:~#mkdir /www
root@hosting01:~#mount /dev/sdb1 /www
 
root@hosting01:~# vi /etc/fstab
# them dong nhu duoi vao - y nghia la mount phan vung sdb1 vao /www khi khoi dong may tinh
/dev/sdb1 /www ext4 defaults 0 0
 
mount /dev/sdb1 /mnt/storage/

Tổng số điểm của bài viết là: 0 trong 0 đánh giá

Click để đánh giá bài viết
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây