Linux 修改 磁盘uuid,如何修改linux磁盘的uuid

如何修改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

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值