หน้าเว็บ

วันอาทิตย์ที่ 24 พฤศจิกายน พ.ศ. 2562

Ubuntu : Ubuntu 18.04 Add Harddisk From Vmware

Ubuntu : Ubuntu 18.04 Add Harddisk From Vmware
1. Add disk edit Vmware
2. Check disk all root@intranet-test:~#
  1. fdisk -l 
Disk /dev/loop0: 88.5 MiB, 92778496 bytes, 181208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43516ABD-068C-45F5-BC44-9BBBBAD0D4D2

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem

Disk /dev/sdb: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

3. Create disk
root@intranet-test:~#
  1. fdisk /dev/sdb
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

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

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): #Enter
First sector (2048-314572799, default 2048): #Enter
Last sector, +sectors or +size{K,M,G,T,P} (2048-314572799, default 314572799):

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

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

4. Convertor disk to ext4
  1. sudo mkfs -t ext4 /dev/sdb1
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 39321344 4k blocks and 9830400 inodes
Filesystem UUID: bf8171ec-a497-4ad8-80a0-aef19903721f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
5 ดู Disk
  1. fdisk -l
Disk /dev/loop0: 88.5 MiB, 92778496 bytes, 181208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43516ABD-068C-45F5-BC44-9BBBBAD0D4D2

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem

Disk /dev/sdb: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbd682c0d

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 314572799 314570752 150G 83 Linux
6. ดู uuid เพื่อเอาไปใส่ใน fstab
  1. ls -al /dev/disk/by-uuid/

7. เพิ่ม uuid ใน fstab เพื่อให้ mount auto เมื่อเปิดเครื่อง
  1. nano /etc/fstab
UUID=bf8171ec-a497-4ad8-80a0-aef19903721f /www ext4 defaults 0 0
8. สร้าง Folder ที่จะ mount ไป ใน
  1. mkdir /www

9. reboot เครื่อง
10. Check ว่า disk ถูก Mount เรียบร้อย
  1. df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 395M 1.1M 394M 1% /run
/dev/sda2 49G 5.8G 41G 13% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 89M 89M 0 100% /snap/core/7270
/dev/sdb1 147G 61M 140G 1% /www
tmpfs 395M 0 395M 0% /run/user/1000
https://oxyme.wordpress.com/2018/08/29/add-install-a-new-hdd-on-ubuntu-18-04-lts-server-edition/

ไม่มีความคิดเห็น:

แสดงความคิดเห็น