-1

I have a partition layout on Ubuntu 10.4 as

sfdisk -l /dev/sdb

Disk /dev/sdb: 121575 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+     60-     61-    487424   83  Linux
/dev/sdb2         60+   2492-   2432-  19530752   82  Linux swap / Solaris
/dev/sdb3       2492+   4923-   2432-  19530752   83  Linux
/dev/sdb4       4923+ 121574- 116652- 937000960   83  Linux

/dev/sdb4 is mounted on /home

df -h /home
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb4             880G  202M  835G   1% /home 

Is there any way to change the name of the device from /dev/sdb4 to /dev/sdb5 and also /dev/sdb5 should be mounted on /home without losing any data.

glglgl
  • 89,107
  • 13
  • 149
  • 217
snow04
  • 159
  • 2
  • 10

1 Answers1

2

To adress mounting: As device names are generally not reliable (across kernel updates and I heard also when removing/adding other disks) you should change your /etc/fstab to reference your partitions by file system uuid

e.g. an /etc/fstab entry like

/dev/sdb4 /home ext3 defaults 0 0

becomes

UUID=YOURUUID /home ext3 defaults 0 0

where YOURUUID is the filesystem UUID which you can get as root with blkid (only use the string between the quotes).

As to changing the name of the device file, such things are done by configuring the udev daemon, though I am confident that changing the partition number is a bad, bad idea (why would you want to do it) so maybe this isn't even possible.

Jo So
  • 25,005
  • 6
  • 42
  • 59
  • +1 Right on. I'm a little surprised it wasn't already using UUIDs... all recent Ubuntu installs I've done have by default. Definitely the way to go. – FatalError Jul 02 '12 at 12:26
  • Jo So I do not need /etc/fstab entry. My problem is simple I need to rename /dev/sdb4 to /dev/sdb5 rest of he changes in fstab I can make it using UUID as you suggested. I need it because I'm setting up a DRBD which needs identical device name. – snow04 Jul 02 '12 at 17:17