Jenkins部署war包和部署jar包的詳細步驟
新增 10G 硬碟,為硬碟分三個分割槽:
檢視新增磁碟
1 [root@localhost ~]# fdisk -l 2 3 Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors 4 Units = sectors of 1 * 512 = 512 bytes 5 Sector size (logical/physical): 512 bytes / 512 bytes 6 I/O size (minimum/optimal): 512 bytes / 512 bytes 7 Disk label type: dos 8 Disk identifier: 0x000b8c209 10 Device Boot Start End Blocks Id System 11 /dev/sda1 * 2048 2099199 1048576 83 Linux 12 /dev/sda2 2099200 209715199 103808000 8e Linux LVM 13 14 Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors 15 Units = sectors of 1 * 512 = 512 bytes 16 Sector size (logical/physical): 512bytes / 512 bytes 17 I/O size (minimum/optimal): 512 bytes / 512 bytes 18 Disk label type: dos 19 Disk identifier: 0x98e3f29a 20 21 Device Boot Start End Blocks Id System 22 /dev/sdb1 2048 2099199 1048576 83 Linux 23 /dev/sdb2 2099200 6293503 2097152 83Linux
建立分割槽
[root@localhost ~]# fdisk /dev/sdb
進入建立分割槽(主分割槽最多建立4個)其他建立步驟一樣,使用p檢視分割槽,w儲存退出,如果建立swap交換磁碟建立磁碟後使用 t 選擇磁碟修改型別swap是82
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-20971519, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G Partition 1 of type Linux and of size 1 GiB is set
建立掛載目錄
[root@localhost ~]# mkdir /part-ext4 [root@localhost ~]# mkdir /part-xfs
格式化,如果格式化出錯使用partprobe 命令重新寫入表
[root@localhost ~]# mkfs.ext4 /dev/sdb1 [root@localhost ~]# mkfs.xfs /dev/sdb2 [root@localhost ~]# mkswap /dev/sdb3
掛載
臨時掛載
[root@localhost ~]# mount /dev/sdb1 /part-ext4/ [root@localhost ~]# mount /dev/sdb2 /part-xfs/
永久掛載,並開機自啟 使用vim 開啟/etc/fstab新增
/dev/sdb1 /part-ext4 ext4 defaults 0 0 /dev/sdb2 /part-xfs xfs defaults 0 0
檢視掛載情況 命令lsblk
├─sdb1 8:17 0 1G 0 part /part-ext4
├─sdb2 8:18 0 2G 0 part /part-xfs
檢視swap
[root@localhost ~]# free -m total used free shared buff/cache available Mem: 972 667 86 13 218 150 Swap: 2047 14 2033
啟動交換分割槽
[root@localhost ~]# swapon /dev/sdb3
再次檢視 如果永久掛載寫入/etc/fstab檔案
[root@localhost ~]# free -m total used free shared buff/cache available Mem: 972 668 85 13 218 149 Swap: 4095 14 4081
檢視掛載情況
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /part-ext4
├─sdb2 8:18 0 2G 0 part /part-xfs
└─sdb3 8:19 0 2G 0 part [SWAP]
建立擴充套件分割槽
[root@localhost ~]# fdisk /dev/sdb
Command (m for help): n Partition type: p primary (3 primary, 0 extended, 1 free) e extended Select (default e): e Selected partition 4 First sector (10487808-20971519, default 10487808): Using default value 10487808 Last sector, +sectors or +size{K,M,G} (10487808-20971519, default 20971519): Using default value 20971519 Partition 4 of type Extended and of size 5 GiB is set
建立邏輯分割槽
Command (m for help): n All primary partitions are in use Adding logical partition 5 First sector (10489856-20971519, default 10489856): Using default value 10489856 Last sector, +sectors or +size{K,M,G} (10489856-20971519, default 20971519): +2G Partition 5 of type Linux and of size 2 GiB is set
檢視分割槽使用 p檢視分割槽
/dev/sdb1 2048 2099199 1048576 83 Linux /dev/sdb2 2099200 6293503 2097152 83 Linux /dev/sdb3 6293504 10487807 2097152 82 Linux swap / Solaris /dev/sdb4 10487808 20971519 5241856 5 Extended /dev/sdb5 10489856 14684159 2097152 83 Linux
格式化
[root@localhost ~]# mkfs.ext4 /dev/sdb5
修改配置檔案vim /etc/auto.master
/autodir /etc/auto.misc --timeout=20
修改配置檔案 vim /etc/auto.misc
test -fstype=ext4 :/dev/sdb5
啟動autofs
[root@localhost ~]# systemctl start autofs
設定開機自啟
systemctl enable autofs
檢視掛載
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /part-ext4
├─sdb2 8:18 0 2G 0 part /part-xfs
├─sdb3 8:19 0 2G 0 part [SWAP]
├─sdb4 8:20 0 512B 0 part
└─sdb5 8:21 0 2G 0 part
sr0 11:0 1 4.4G 0 rom /mnt/cdrom
跳轉後檢視 cd/autodir/test
sdb 8:16 0 10G 0 disk
├─sdb1 8:17 0 1G 0 part /part-ext4
├─sdb2 8:18 0 2G 0 part /part-xfs
├─sdb3 8:19 0 2G 0 part [SWAP]
├─sdb4 8:20 0 512B 0 part
└─sdb5 8:21 0 2G 0 part /autodir/test
退出/autodir/test目錄等待20s後自動取消掛載