linux图形界面改uuid,如何修改linux磁盘的uuid

当Linux磁盘的UUID更改,导致系统启动时报错时,可以通过以下步骤解决:1) 使用`blkid`或`ls /dev/disk/by-uuid/`获取新的UUID;2) 使用`vim`或`echo`命令更新`/etc/fstab`中的UUID信息;3) 重新挂载并更新UUID;4) 重启系统。确保正确修改`fstab`文件,以避免系统启动问题。
摘要由CSDN通过智能技术生成

如何修改linux磁盘的uuid删除数据盘并再度分区和格式化后,重启会报错,此时如何解决问题?

1)得到uuid

# blkid /dev/sdb1

/dev/sdb1: UUID="294c8a0c-86e1-441f-8e5a-df5a4fc4585a" TYPE="ext4"

# ls -l /dev/disk/by-uuid/ |grep sdb

lrwxrwxrwx 1 root root 10 Jul 29 10:26 294c8a0c-86e1-441f-8e5a-df5a4fc4585a -> ../../sdb1

2)更新原来的uuid

# mount –o remount,rw /

# vim /etc/fstab

将:

UUID=8fc1e2f4-a6b4-4c5c-99d9-c6ae545a6d63 /data                   ext4    defaults        1 2

修改为:

UUID=294c8a0c-86e1-441f-8e5a-df5a4fc4585a /data                   ext4    defaults        1 2

或者可以这样:

echo "UUID=$(blkid /dev/sdb1 |cut -d'"' -f2) /data                 ext4    defaults        1 2" >>/etc/fstab

重启系统:

reboot

fstab中的内容解释请参考man中的内容。

The first field, (fs_spec), describes the block special device or remote filesystem

to be mounted.

指定被挂载的设备

The second field, (fs_file), describes the mount point  for  the  filesystem.   For

swap partitions, this field should be specified as ‘none’. If the name of the mount

point contains spaces these can be escaped as ‘\040’.

指定挂载点

The third field, (fs_vfstype), describes the type of the  filesystem.

指定fs格式

The fourth  field,  (fs_mntops),  describes  the mount options associated with the

filesystem.

指定挂载选项

The fifth field, (fs_freq), is used for these filesystems by the dump(8) command to

determine  which filesystems need to be dumped.  If the fifth field is not present,

a value of zero is returned and dump will assume that the filesystem does not  need

to be dumped.

供dump用

The sixth field, (fs_passno), is used by the fsck(8) program to determine the order

in which filesystem checks are done at reboot time.  The root filesystem should  be

specified  with  a fs_passno of 1, and other filesystems should have a fs_passno of

2.  Filesystems within a drive will be checked  sequentially,  but  filesystems  on

different  drives will be checked at the same time to utilize parallelism available

in the hardware.  If the sixth field is not present or zero, a  value  of  zero  is

returned and fsck will assume that the filesystem does not need to be checked.

供fsck用,root是1,其他的fs是2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值