伺服器安裝Ubuntu Server 18.04及磁碟分割槽
阿新 • • 發佈:2018-11-01
安裝Ubuntu18.04 server
- Ubuntu 18.04下載地址 http://releases.ubuntu.com/18.04/
- 用軟碟通製作一個U盤啟動盤
分割槽
伺服器上有3塊磁碟,一塊900G的SSD,兩個合在一起1.8T的機械硬碟,兩個機械硬碟做成了一個陣列(一個大神幫忙做的)
系統Ubuntu預設分割槽,安裝在了SSD上,剩下的1.8T想利用起來放資料,打算新建分割槽:
首先用fdisk -l
命令檢視當前磁碟分割槽情況,可以看到裝置/dev/sdb
沒有分割槽:
# fdisk -l
Disk /dev/loop0: 86.9 MiB, 91099136 bytes, 177928 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/sdb: 1.8 TiB, 1998998994944 bytes, 3904294912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sda: 745.2 GiB, 800166076416 bytes, 1562824368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D3EA883E-7D9A-4843-966B-45420852A8C5
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 1562820607 1562816512 745.2G Linux filesystem
[email protected]:/usr/include# fdisk /dev/sdb
建立分割槽/dev/sdb1
:
# 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. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xd97078ec. 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): 1 First sector (2048-3904294911, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-3904294911, default 3904294911): Created a new partition 1 of type 'Linux' and of size 1.8 TiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
分割槽之後格式化:
# mkfs -t ext4 /dev/sdb1 mke2fs 1.44.1 (24-Mar-2018) Creating filesystem with 488036608 4k blocks and 122011648 inodes Filesystem UUID: 2c3ba699-2ef6-4551-b6ca-ac2b8691b3a1 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
磁碟檢查:
# fsck -C -f -t ext4 /dev/sdb1
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 11/122011648 files (0.0% non-contiguous), 7941569/488036608 blocks
新建一個資料夾/data,作為將來訪問sdb1的標識,並將新磁碟sdb1掛載到/data:
# mkdir /data
# mount -t ext4 /dev/sdb1 /data/
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 32G 0 32G 0% /dev
tmpfs 6.3G 1.9M 6.3G 1% /run
/dev/sda2 733G 11G 686G 2% /
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/loop0 87M 87M 0 100% /snap/core/4917
tmpfs 6.3G 0 6.3G 0% /run/user/1000
/dev/sdb1 1.8T 77M 1.7T 1% /data
[email protected]:~# fdisk -l
Disk /dev/loop0: 86.9 MiB, 91099136 bytes, 177928 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/sdb: 1.8 TiB, 1998998994944 bytes, 3904294912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xd97078ec
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 3904294911 3904292864 1.8T 83 Linux
Disk /dev/sda: 745.2 GiB, 800166076416 bytes, 1562824368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D3EA883E-7D9A-4843-966B-45420852A8C5
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 1562820607 1562816512 745.2G Linux filesystem
強制讓核心重新找找一次分割槽表:
# partprobe