linux開機自動掛載硬碟

2021-10-08 02:49:52 字數 3008 閱讀 6551

這裡以rk3399為例,安裝的是ubuntu18.0.4伺服器版本

1)首先檢視磁碟是哪一塊

$ sudo

fdisk -l

disk /dev/mmcblk1: 58.5 gib, 62813896704 bytes, 122683392 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: 992df2c2-0170-4f66-9492-fbf320673eef

device start end sectors size type

/dev/mmcblk1p1 64 8063 8000 3.9m linux filesystem

/dev/mmcblk1p2 16384 24575 8192 4m linux filesystem

/dev/mmcblk1p3 24576 32767 8192 4m linux filesystem

/dev/mmcblk1p4 32768 262143 229376 112m efi system

/dev/mmcblk1p5 262144 122683358 122421215 58.4g linux filesystem

disk /dev/sda: 1.8 tib, 2000398931968 bytes, 3907029164 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: 0x398f62b1

device boot start end sectors size id type

/dev/sda1 * 206848 3907026943 3906820096 1.8t 7 hpfs/ntfs/exfat

檢視發現/dev/sda1是外接硬碟,有1.8t

2)掛載

$ cd /mnt

$ sudo

mkdir sda1

$ sudo

mount /dev/sda1 /mnt/sda1

問題:ount: /mnt/sda1: unknown filesystem type 『ntfs』.

需要將磁碟格式化為可識別的格式,比如fat32

3)開機自動掛載

每次重啟,硬碟裝置標識始終為/dev/sda1

$ sudo blkid

/dev/mmcblk1: ptuuid=

"992df2c2-0170-4f66-9492-fbf320673eef" pttype=

"gpt"

/dev/mmcblk1p1: partlabel=

"loader1" partuuid=

"95d89d52-ca00-42d6-883f-50f5720ef37e"

/dev/mmcblk1p2: partlabel=

"loader2" partuuid=

"78be2786-acb9-4885-bb6c-77dddef5aac9"

/dev/mmcblk1p3: partlabel=

"trust" partuuid=

"a36bc2fb-b345-417b-8aef-b49ea06c1f7b"

/dev/mmcblk1p4: sec_type=

"msdos" label=

"boot" uuid=

"1121-c996" type=

"vfat" partlabel=

"boot" partuuid=

"cee6ebd4-da8f-4378-a430-05693004c5da"

/dev/mmcblk1p5: label=

"ubt-bionic" uuid=

"9d4f00d3-3731-4dac-a791-7dbd9cb156e2" type=

"ext4" partlabel=

"rootfs" partuuid=

"b921b045-1df0-41c3-af44-4c6f280d3fae"

/dev/sda1: label=

"backup" uuid=

"16f0-0b2b" type=

"vfat" partuuid=

"5633890f-01"

$ sudo vim /etc/fstab

最後新增一行 /dev/sda1 /mnt/sda1 vfat defaults 0 2

# unconfigured fstab for base system

# /etc/fstab: static file system information.##

# /etc/fstab: static file system information.##

/dev/mmcblk1p4 /boot vfat defaults 0 2

/dev/sda1 /mnt/sda1 vfat defaults 0 2

$ sudo

mount -a

$ sudo

reboot

重啟驗證

linux掛載新硬碟,開機自動掛載

linux的硬碟識別 2.6 kernel以後,linux會將識別到的硬體裝置,在 dev 下建立相應的裝置檔案.如 sda 表示第1塊scsi硬碟.v,z b,2 f7 u hda 表示第1塊ide硬碟 即連線在第1個ide介面的master口上 scd0 表示第1個usb光碟機.當新增了新硬碟後...

ubuntu開機自動掛載硬碟

掛在的命令是mount,當然可以把這個命令加到 etc rc.local裡。除此之外還有另外一種方法 etc fstab 新增新的內容 分割槽定位,可以給磁碟號,uuid或label,例如 dev sda2,uuid 6e9adac29ada85cd或label software 具體掛載點的位置,...

Ubunut開機自動掛載硬碟

原文源自 1 檢視linux硬碟資訊 sudo fdisk l2 格式化硬碟 根據需要確定檔案系統 sudo mkfs.xfs dev sdb3 建立 data目錄 sudo mkdir data4 掛載分割槽 sudo mount dev sdb datamount命令重啟後會失效,將分割槽資訊寫...