日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux磁盘管理

發(fā)布時間:2023/12/8 linux 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux磁盘管理 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

知識腦圖

https://note.youdao.com/s/Zraw9hSl

題目

1、基本存儲配置
1) 添加一塊10G大小的磁盤,將該磁盤分為兩個主分區(qū),大小為1G、2G。將剩余的空間全部劃分為擴展分
區(qū)。劃分一個邏輯分區(qū),大小為3G。(主分區(qū)文件系統(tǒng)類型為ext4,邏輯分區(qū)文件系統(tǒng)類型為xfs)
2) 將三個分區(qū)分別掛載到/dir1、/dir2、/dir3。
3) 在第一個主分區(qū)中創(chuàng)建一個文件為file1,內(nèi)容為this is partition1。在第二個分區(qū)中創(chuàng)建一個文
件為file2,內(nèi)容為this is partition2。在第三個分區(qū)中創(chuàng)建一個文件為file3,內(nèi)容為this is
partition3。

答案

1) 添加一塊10G大小的磁盤,將該磁盤分為兩個主分區(qū),大小為1G、2G。將剩余的空間全部劃分為擴展分
區(qū)。劃分一個邏輯分區(qū),大小為3G。(主分區(qū)文件系統(tǒng)類型為ext4,邏輯分區(qū)文件系統(tǒng)類型為xfs)

[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 50G 0 disk ├─sda1 8:1 0 600M 0 part /boot └─sda2 8:2 0 38G 0 part ├─rhel-root 253:0 0 30G 0 lvm /├─rhel-swap 253:1 0 3G 0 lvm [SWAP]└─rhel-home 253:2 0 5G 0 lvm /home sdb 8:16 0 10G 0 disk sr0 11:0 1 10.2G 0 rom [root@localhost ~]# fd fdformat fdisk [root@localhost ~]# fdisk /dev/sdbWelcome to fdisk (util-linux 2.32.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 0x109ae473.Command (m for help): n Partition typep 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-20971519, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +1GCreated a new partition 1 of type 'Linux' and of size 1 GiB.Command (m for help): n Partition typep primary (1 primary, 0 extended, 3 free)e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): 2 First sector (2099200-20971519, default 2099200): Last sector, +sectors or +size{K,M,G,T,P} (2099200-20971519, default 20971519): +2GCreated a new partition 2 of type 'Linux' and of size 2 GiB.Command (m for help): n Partition typep primary (2 primary, 0 extended, 2 free)e extended (container for logical partitions) Select (default p): e Partition number (3,4, default 3): 3 First sector (6293504-20971519, default 6293504): Last sector, +sectors or +size{K,M,G,T,P} (6293504-20971519, default 20971519): +7G Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (6293504-20971519, default 20971519): Created a new partition 3 of type 'Extended' and of size 7 GiB.Command (m for help): n All space for primary partitions is in use. Adding logical partition 5 First sector (6295552-20971519, default 6295552): Last sector, +sectors or +size{K,M,G,T,P} (6295552-20971519, default 20971519): +3GCreated a new partition 5 of type 'Linux' and of size 3 GiB. Command (m for help): p Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 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: 0x109ae473Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 2099199 2097152 1G 83 Linux /dev/sdb2 2099200 6293503 4194304 2G 83 Linux /dev/sdb3 6293504 20971519 14678016 7G 5 Extended /dev/sdb5 6295552 12587007 6291456 3G 83 LinuxCommand (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.[root@localhost ~]# mkfs.ext4 /dev/sdb1 mke2fs 1.45.6 (20-Mar-2020) Creating filesystem with 262144 4k blocks and 65536 inodes Filesystem UUID: f244ae4c-6f80-4d9d-b3ab-6582dafb9ca7 Superblock backups stored on blocks: 32768, 98304, 163840, 229376Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done[root@localhost ~]# mkfs.ext4 /dev/sdb2 mke2fs 1.45.6 (20-Mar-2020) Creating filesystem with 524288 4k blocks and 131072 inodes Filesystem UUID: b850b145-73f9-4dc2-bab7-891cf31db966 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done [root@localhost ~]# blkid /dev/sda1: UUID="36ba8315-64a9-433f-88ca-dbb1d995b7f5" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="32361dfd-01" /dev/sda2: UUID="Gdz4Gv-HrX2-weAR-XfJk-fFa9-tCqJ-oc8OBH" TYPE="LVM2_member" PARTUUID="32361dfd-02" /dev/sdb1: UUID="f244ae4c-6f80-4d9d-b3ab-6582dafb9ca7" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="109ae473-01" /dev/sdb2: UUID="b850b145-73f9-4dc2-bab7-891cf31db966" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="109ae473-02" /dev/sdb5: UUID="323e38bd-9e59-4274-837e-f21d5a9cfe63" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="109ae473-05" /dev/sr0: BLOCK_SIZE="2048" UUID="2021-10-13-03-57-25-00" LABEL="RHEL-8-5-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="4d694e6c" PTTYPE="dos" /dev/mapper/rhel-root: UUID="6708cd69-63f5-4717-837f-3213b6703943" BLOCK_SIZE="512" TYPE="xfs" /dev/mapper/rhel-swap: UUID="f0cc1221-a76d-4d45-90de-76f9b88eb779" TYPE="swap" /dev/mapper/rhel-home: UUID="7526f9a5-37fa-43f2-a44a-0680c6f6602b" BLOCK_SIZE="512" TYPE="xfs"

2) 將三個分區(qū)分別掛載到/dir1、/dir2、/dir3。

[root@localhost /]# mkdir /dir1 [root@localhost /]# mkdir /dir2 [root@localhost /]# mkdir /dir3 [root@localhost /]# mount /dev/sdb1 /dir1 [root@localhost /]# mount /dev/sdb2 /dir2 [root@localhost /]# mount /dev/sdb3 /dir3 [root@localhost /]# mount /dev/sdb5 /dir3

3) 在第一個主分區(qū)中創(chuàng)建一個文件為file1,內(nèi)容為this is partition1。在第二個分區(qū)中創(chuàng)建一個文
件為file2,內(nèi)容為this is partition2。在第三個分區(qū)中創(chuàng)建一個文件為file3,內(nèi)容為this is
partition3。

[root@localhost /]# echo this is partition1 > /dir1/file1 [root@localhost /]# echo this is partition2 > /dir2/file2 [root@localhost /]# echo this is partition3 > /dir3/file3 [root@localhost /]# ll /dir1 /dir2 /dir3 /dir1: total 24 -rw-r--r--. 1 root root 19 Nov 4 10:43 file1 drwx------. 2 root root 16384 Nov 4 09:18 lost+found/dir2: total 20 -rw-r--r--. 1 root root 19 Nov 4 10:44 file2 drwx------. 2 root root 16384 Nov 4 09:18 lost+found/dir3: total 4 -rw-r--r--. 1 root root 19 Nov 4 10:45 file3

總結(jié)

以上是生活随笔為你收集整理的linux磁盘管理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。