服务器安装Ubuntu Server 18.04及磁盘分区

安装Ubuntu18.04 server

  1. Ubuntu 18.04下载地址 http://releases.ubuntu.com/18.04/
  2. 用软碟通制作一个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
root@lab1706:/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
root@lab1706:~# 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

猜你喜欢

转载自blog.csdn.net/anzhou7262/article/details/83548269