如何在 Linux 中重命名 /dev/sdax(partitions)

MLS*_*LSC 5 partition mount fstab rename

/part在我的机器上做了一个分区,里面有一些重要的数据......

但我受不了它的名字......

我想要一个明确的解决方案来解决它并将其名称更改为例如/test...

如您所见,这是我的/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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=a21a99c4-e5b4-4197-ac5e-80d0fab1f30c /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda6 during installation
UUID=2e37d833-ca34-4fa7-a5d8-a4423a5af9bc /home           ext4    defaults          0       2
# /part was on /dev/sda7 during installation
UUID=47e6e0b1-0e57-4184-a378-375b9ce315c5 /part           ext4    defaults          0       2
# swap was on /dev/sda1 during installation
UUID=485e9f78-4dce-4404-af4e-f43985525264 none            swap    sw                0       0
Run Code Online (Sandbox Code Playgroud)

重点是:我的信息很重要,我害怕在不确定的情况下操纵它......我想要一个安全的解决方案......

这怎么可能?

Jos*_* R. 7

#当然是为了代表您的root提示,而不是要输入的实际输入。

在虚拟数据上测试此解决方案或任何其他解决方案的安全性

以下说明(部分)从虚拟文件系统中窃取:从普通文件构建 Linux 文件系统

  • 创建一个大小为 20 MB 的普通文件(例如):

    $ dd if=/dev/zero of=dummy_fs bs=1k count=20480 # 20480 = 20 * 1024
    
    Run Code Online (Sandbox Code Playgroud)
  • ext4在您的文件上创建一个文件系统:

    $ /sbin/mkfs -t ext4 dummy_fs       
    mke2fs 1.42.5 (29-Jul-2012)
    dummy_fs is not a block special device.
    Proceed anyway? (y,n) y
    ... # Output of mkfs
    
    Run Code Online (Sandbox Code Playgroud)
  • 挂载文件系统映像,在其上创建一些虚拟数据并测试解决方案:

    # mkdir /tmp/testmount
    # mount -o loop dummy_fs /tmp/testmount
    # touch /tmp/testmount/{blah,bleh} # Create dummy data
    # ls /tmp/testmount
    blah bleh lost+found
    # umount /tmp/testmount
    # mountpoint /tmp/testmount &>/dev/null || mv /tmp/testmount /tmp/sexy_name
    # mount -o loop dummy_fs /tmp/sexy_name
    # ls /tmp/sexy_name # to ensure your data is intact:
    blah bleh lost+found
    
    Run Code Online (Sandbox Code Playgroud)