الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

معمل 14.1RHCSA 10, الفصل 14

Partitions, file systems, swap and fstab

المستوى
متوسط
45 دقيقة
الأجهزة
server1
الحالة
لم يبدأ

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

الهدف

Use a second disk to create three partitions with a file system, a swap space, and a mount that works after every reboot.

قبل أن تبدأ

  • Add an empty 10 GiB disk to server1 (in this lab: /dev/vdb). Check with lsblk that it really is empty — use your own device name.
  • Work as root.

المهام

  1. Create a GPT partition table on the disk with three partitions: 2 GiB, 1 GiB and 2 GiB.
  2. Put an XFS file system with the label data on partition 1, and mount it on /data at every boot by UUID.
  3. Use partition 2 as extra swap, active at every boot.
  4. Put an ext4 file system on partition 3. It must be mounted on /backup at boot with the options noexec,nosuid, with a systemd mount unit (not fstab).
  5. Set the reserved blocks of the ext4 file system to 1 %.
  6. Reboot and check that everything is mounted and the swap is active.

تحقّق من عملك

lsblk -f /dev/vdb
findmnt /data; findmnt /backup
swapon --show
tune2fs -l /dev/vdb3 | grep -i 'reserved block count'
systemctl is-enabled backup.mount
  • /data is XFS with label data, /backup is ext4 with noexec,nosuid.
  • swapon shows /dev/vdb2 next to the system swap.
  • After the reboot all of it is still there.

تلميحات

اعرض التلميحات
  • fdisk: g, then three times n with +2G, +1G, +2G; type of partition 2: swap.
  • blkid /dev/vdb1 gives the UUID for fstab.
  • The unit for /backup is /etc/systemd/system/backup.mount.
  • tune2fs -m 1.

الحل

اعرض الحل
  1. Partitions.
    fdisk /dev/vdb
    Command (m for help): g
    Command (m for help): n          (Enter, Enter, +2G)
    Command (m for help): n          (Enter, Enter, +1G)
    Command (m for help): n          (Enter, Enter, +2G)
    Command (m for help): t          (2, swap)
    Command (m for help): w
    partprobe /dev/vdb
  2. XFS on /data by UUID.
    mkfs.xfs -L data /dev/vdb1
    mkdir /data
    echo "UUID=$(blkid -s UUID -o value /dev/vdb1) /data xfs defaults 0 0" >> /etc/fstab
  3. Swap.
    mkswap /dev/vdb2
    echo "UUID=$(blkid -s UUID -o value /dev/vdb2) none swap defaults 0 0" >> /etc/fstab
    systemctl daemon-reload; mount -a; swapon -a
  4. ext4 with a mount unit.
    mkfs.ext4 /dev/vdb3
    mkdir /backup
    blkid -s UUID -o value /dev/vdb3
    /etc/systemd/system/backup.mount
    [Unit]
    Description=Backup disk
     
    [Mount]
    What=/dev/disk/by-uuid/PUT-THE-UUID-HERE
    Where=/backup
    Type=ext4
    Options=noexec,nosuid
     
    [Install]
    WantedBy=multi-user.target
    systemctl daemon-reload
    systemctl enable --now backup.mount
  5. Reserved blocks.
    tune2fs -m 1 /dev/vdb3
  6. Reboot and check.
    systemctl reboot
    findmnt /data; findmnt /backup; swapon --show

ملاحظاتي

لا توجد ملاحظات بعد.

دروس هذا المعمل

الأوامر في هذا المعمل