參考文獻:http://www.j4.com.tw/comp-qna/ubuntu-%E6%96%B0%E5%A2%9E%E7%A1%AC%E7%A2%9F%EF%BC%88%E7%A3%81%E7%A2%9F%E5%88%86%E5%89%B2%E3%80%81%E6%A0%BC%E5%BC%8F%E5%8C%96%E8%88%87%E6%8E%9B%E8%BC%89%EF%BC%89/
有時候不知道為甚麼會從4T變2T,使用fdisk時,請不要用n,要用g。
# fdisk -l /dev/sdb 檢查大小是否正確,再重新用n劃過partition。
# fdisk -l /dev/sd*
Disk /dev/sdb: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD4005FZBX-0
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: 0DEE185D-F44F-A945-A369-B387A7AC8A14
所用裝置 Start 結束 磁區 Size 類型
/dev/sdb1 2048 7814037134 7814035087 3.7T Linux filesystem
(base) root@rdwks:/home/cltai# fdisk -l /dev/sd*
Disk /dev/sda: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD4005FZBX-0
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: 5C21C765-994E-4B06-99BE-D804E248F522
所用裝置 Start 結束 磁區 Size 類型
/dev/sda1 2048 7814037134 7814035087 3.7T Linux filesystem
Disk /dev/sda1: 3.65 TiB, 4000785964544 bytes, 7814035087 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/sdb: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD4005FZBX-0
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: 0DEE185D-F44F-A945-A369-B387A7AC8A14
所用裝置 Start 結束 磁區 Size 類型
/dev/sdb1 2048 7814037134 7814035087 3.7T Linux filesystem
Disk /dev/sdb1: 3.65 TiB, 4000785964544 bytes, 7814035087 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/sdc: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD4005FZBX-0
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/sdd: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD4005FZBX-0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
i# fdisk /dev/sdc
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.
The size of this disk is 3.7 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Created a new DOS disklabel with disk identifier 0xf9ac92eb.
命令 (m 以獲得說明): g <<<<先用這個,才會劃出全部的HD Space。
Created a new GPT disklabel (GUID: 9FA86EEC-E00C-D947-B432-E6190F8A0E4D).
命令 (m 以獲得說明): n
分割區編號 (1-128, default 1):
First sector (2048-7814037134, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7814037134, default 7814037134):
Created a new partition 1 of type 'Linux filesystem' and of size 3.7 TiB.
命令 (m 以獲得說明): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
以上是劃好partition。
# mkfs -t ext4 /dev/sdb1 <<<format ext4的格式。
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 976754385 4k blocks and 244195328 inodes
Filesystem UUID: 9a83c92b-85f7-4f9f-b582-834e19ebe079
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
i# blkid
/dev/nvme0n1p1: UUID="5180-51BF" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="913530a1-60f7-464d-bae3-b780218ea6c6"
/dev/nvme0n1p2: UUID="29405123-ed0a-42ec-bd04-2a8d31cc4340" TYPE="ext4" PARTUUID="22ac00c1-2732-4355-8e80-9a36ab6250a7"
/dev/nvme0n1p3: UUID="a836bd86-006c-4453-9a72-5b366abe34ff" UUID_SUB="fff7362f-e87d-4575-8330-78969acc4b1a" TYPE="btrfs" PARTUUID="98ae9e48-02f7-477c-9d16-85ddd40c90a3"
/dev/nvme0n1p4: UUID="e22f6e0f-d8f9-4640-97b6-25058306ad2e" UUID_SUB="d5bcd70a-92f6-478f-81a7-03cf47872a6a" TYPE="btrfs" PARTUUID="fa3b317e-389f-4f7b-b06e-d4bd6aa0b52b"
(以上這四個是開機時劃的,在SSD上)
/dev/sdc1: UUID="9b92f550-525e-4ed5-9991-de58f9aba824" TYPE="ext4" PARTUUID="877cddd6-0cec-c445-8022-62f23fee451a"
/dev/sdd1: UUID="cc639611-2e73-4c4a-91a7-742b5a55145d" TYPE="ext4" PARTUUID="08159ad9-0aaf-d440-80cc-61fef5c6c3da"
/dev/sda1: UUID="64e9bd24-160a-4b63-83ff-473509bb7803" TYPE="ext4" PARTUUID="fb833944-1968-114a-b1b7-65ad3da5c9fc"
/dev/sdb1: UUID="9a83c92b-85f7-4f9f-b582-834e19ebe079" TYPE="ext4" PARTUUID="d6d23879-6fa8-9645-9788-f7a39fcaf557"
(以上這四個是傳統SATA的HD,每顆4T)
# vi 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>
# / was on /dev/nvme0n1p3 during installation
UUID=a836bd86-006c-4453-9a72-5b366abe34ff / btrfs defaults,subvol=@ 0 1
# /boot was on /dev/nvme0n1p2 during installation
UUID=29405123-ed0a-42ec-bd04-2a8d31cc4340 /boot ext4 defaults 0 2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=5180-51BF /boot/efi vfat umask=0077 0 1
# /home was on /dev/nvme0n1p4 during installation
UUID=e22f6e0f-d8f9-4640-97b6-25058306ad2e /home btrfs defaults,subvol=@home 0 2
/swapfile none swap sw 0 0
# Following are SATA HD #
UUID=64e9bd24-160a-4b63-83ff-473509bb7803 /home/steventsai/data ext4 defaults 0 0
UUID=9a83c92b-85f7-4f9f-b582-834e19ebe079 /home/steventsai/data2 ext4 defaults 0 0
UUID=9b92f550-525e-4ed5-9991-de58f9aba824 /data ext4 defaults 0 0
UUID=cc639611-2e73-4c4a-91a7-742b5a55145d /backup ext4 defaults 0 0
# reboot
就會掛進去系統了喔。但要改目錄權限。
留言列表