GPU 服务器配置记录(一)

GPU 服务器配置记录 (一)挂载硬盘

最近显卡降价,新配了一台服务器用于开发。以下为服务器配置过程的记录。

Ubuntu 挂载硬盘

STEP 1 查看硬盘状态

输入命令 sudo fdisk -l

Disk /dev/loop0: 4 KiB, 4096 bytes, 8 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/loop1: 65.22 MiB, 68378624 bytes, 133552 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/loop2: 248.78 MiB, 260841472 bytes, 509456 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/loop3: 54.24 MiB, 56872960 bytes, 111080 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/loop4: 43.6 MiB, 45703168 bytes, 89264 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/loop5: 61.93 MiB, 64917504 bytes, 126792 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/loop6: 44.69 MiB, 46845952 bytes, 91496 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/loop7: 61.92 MiB, 64909312 bytes, 126776 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/nvme0n1: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: KINGSTON SNVS500G                       
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: ECD7DB41-C680-44DF-9C4D-102C06171497

Device           Start       End   Sectors   Size Type
/dev/nvme0n1p1    2048   1050623   1048576   512M EFI System
/dev/nvme0n1p2 1050624 976771071 975720448 465.3G Linux LVM


Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-00B
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/mapper/vgubuntu-root: 464.31 GiB, 498539167744 bytes, 973709312 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/mapper/vgubuntu-swap_1: 980 MiB, 1027604480 bytes, 2007040 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
server@server-H510M-S2:~$ sudo blkid
/dev/mapper/vgubuntu-swap_1: UUID="9d6204a0-bf5c-4efb-b55c-683ebfda05ef" TYPE="swap"
/dev/mapper/vgubuntu-root: UUID="eeee27cf-2b9c-4814-a6af-0a9b9f43b45f" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/nvme0n1p1: UUID="D8A1-6CC3" TYPE="vfat" PARTUUID="c78f4448-e6e9-46fe-b3a5-803263188ee5"
/dev/nvme0n1p2: UUID="rHxL8o-vqRv-we7q-itJt-4A13-2yO5-ZcLZBy" TYPE="LVM2_member" PARTUUID="6d8e30b6-e67a-4f13-afa2-e951328aaa57"

服务器配有两块硬盘,一块500G固态硬盘,一块1T机械盘,依据空间大小,其中 /dev/sda为需要挂载的机械盘。(类似的可以通过 ls /dev/sd*来查看盘符)

STEP 2 创建新的分区并进行格式化

创建分区命令 sudo fdisk /dev/sda
显示以及相关操作如下所示:
其中
m 获取命令帮助
n 创建新的分区(后续默认即可)

server@server-H510M-S2:~$ sudo fdisk /dev/sda

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 0x769d61a5.

Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table


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

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

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

格式化命令:sudo mkfs -t ext4 /dev/sda1

STEP 3 挂载硬盘

临时挂载使用 mount 命令。这里需要开机自动挂载,故需要获取新分区的 UUID 并在 /etc/fstab 中添加相关信息。

查看 UUID 命令 ls -l /dev/disk/by-uuid/

total 0
lrwxrwxrwx 1 root root 10 5月   7 20:08 9d6204a0-bf5c-4efb-b55c-683ebfda05ef -> ../../dm-1
lrwxrwxrwx 1 root root 15 5月   7 20:08 D8A1-6CC3 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 10 5月   7 20:08 db7131a3-de9e-46ee-bb52-8c488758747a -> ../../sda1
lrwxrwxrwx 1 root root 10 5月   7 20:08 eeee27cf-2b9c-4814-a6af-0a9b9f43b45f -> ../../dm-0

创建挂载点 sudo mkdir /home/DataPartition
编辑 /etc/fstab在最后一行中添加挂载信息。如下所示:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/vgubuntu-root /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=D8A1-6CC3  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/vgubuntu-swap_1 none            swap    sw              0       0
UUID=db7131a3-de9e-46ee-bb52-8c488758747a /home/DataPartition ext4 defaults 0 2

STEP 4 检查是否成功

重启后,输入 df -h 查看挂载情况

Filesystem                 Size  Used Avail Use% Mounted on
udev                        16G     0   16G   0% /dev
tmpfs                      3.2G  1.8M  3.2G   1% /run
/dev/mapper/vgubuntu-root  457G  7.2G  426G   2% /
tmpfs                       16G     0   16G   0% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
tmpfs                       16G     0   16G   0% /sys/fs/cgroup
/dev/loop0                 128K  128K     0 100% /snap/bare/5
/dev/loop1                  62M   62M     0 100% /snap/core20/1328
/dev/loop2                  55M   55M     0 100% /snap/snap-store/558
/dev/loop4                  44M   44M     0 100% /snap/snapd/14978
/dev/loop3                  66M   66M     0 100% /snap/gtk-common-themes/1519
/dev/loop5                 249M  249M     0 100% /snap/gnome-3-38-2004/99
/dev/nvme0n1p1             511M  5.3M  506M   2% /boot/efi
/dev/loop6                  45M   45M     0 100% /snap/snapd/15534
/dev/loop7                  62M   62M     0 100% /snap/core20/1434
/dev/sda1                  916G   77M  870G   1% /home/DataPartition
tmpfs                      3.2G  8.0K  3.2G   1% /run/user/1000
tmpfs                      3.2G   16K  3.2G   1% /run/user/125

可以看到,/dev/sda1已经成功挂载。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值