[CentOS] Re-mount a drive using its label name

Fri May 16 17:44:35 UTC 2014
Raghuv Adhepalli <raghuv.adhepalli at seagate.com>

@Mauricio: Yes the drive's sd name keeps changing with removal and
addition. Thought labels can be used as alternative to maintain
consistency. As you can see in my dmesg output, sdf changed to sdj

@zep: No I do not use partitions. I use the entire drive.

@mark: This is my dmesg output,

XFS (sdf): xfs_log_force: error 5 returned.
sd 0:0:9:0: [sdj] Synchronizing SCSI cache
sd 0:0:9:0: [sdj] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
mpt2sas0: removing handle(0x000e), sas_addr(0x4433221105000000)
XFS (sdf): xfs_log_force: error 5 returned.
scsi 0:0:10:0: Direct-Access     ATA      ST1000LM014-1EJ1 SM11 PQ: 0 ANSI:
6
scsi 0:0:10:0: SATA: handle(0x000e), sas_addr(0x4433221105000000), phy(5),
device_name(0x0000000000000000)
scsi 0:0:10:0: SATA: enclosure_logical_id(0x500605b007292d30), slot(5)
scsi 0:0:10:0: atapi(n), ncq(y), asyn_notify(n), smart(y), fua(y),
sw_preserve(y)
scsi 0:0:10:0: qdepth(32), tagged(1), simple(1), ordered(0), scsi_level(7),
cmd_que(1)
sd 0:0:10:0: Attached scsi generic sg5 type 0
sd 0:0:10:0: [sdj] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
sd 0:0:10:0: [sdj] 4096-byte physical blocks
sd 0:0:10:0: [sdj] Write Protect is off
sd 0:0:10:0: [sdj] Mode Sense: 7f 00 10 08
sd 0:0:10:0: [sdj] Write cache: enabled, read cache: enabled, supports DPO
and FUA
 sdj: unknown partition table
sd 0:0:10:0: [sdj] Attached SCSI disk
XFS (sdj): Filesystem has duplicate UUID
a05866dd-f84e-4873-9c39-5e264cd929c0 - can't mount
XFS (sdf): xfs_log_force: error 5 returned.
[root at raghuv07 ~]# dmesg | tail
sd 0:0:10:0: Attached scsi generic sg5 type 0
sd 0:0:10:0: [sdj] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
sd 0:0:10:0: [sdj] 4096-byte physical blocks
sd 0:0:10:0: [sdj] Write Protect is off
sd 0:0:10:0: [sdj] Mode Sense: 7f 00 10 08
sd 0:0:10:0: [sdj] Write cache: enabled, read cache: enabled, supports DPO
and FUA
 sdj: unknown partition table
sd 0:0:10:0: [sdj] Attached SCSI disk
XFS (sdj): Filesystem has duplicate UUID
a05866dd-f84e-4873-9c39-5e264cd929c0 - can't mount
XFS (sdf): xfs_log_force: error 5 returned.




On Fri, May 16, 2014 at 11:39 AM, Mauricio Tavares <raubvogel at gmail.com>wrote:

> On Fri, May 16, 2014 at 1:34 PM,  <m.roth at 5-cent.us> wrote:
> > Raghuv Adhepalli wrote:
> >> Hello everybody,
> >>
> >> I would like your opinion on the following question, why this happens in
> >> centos and how to fix this (or a possible work around).
> >>
> >> I have a drive with no partitions and formatted with xfs filesystem. I
> >> give the drive a custom label "mydrive" and I mount it under
> >> /dev/mountpnts/mydrive.
> >> Then, I add a corresponding entry to fstab.
> >>
> >> These, are the steps I followed,
> >>
> >> mkfs.xfs -L mydrive -f /dev/sdf
> >> mkdir /dev/mountpnts/mydrive
> >> mount -L mydrive /dev/mountpnts/mydrive/
> >>
> >> cat /etc/fstab,
> >> LABEL=mydrive /dev/mountpnts/mydrive xfs
> >> noatime,nodiratime,nobarrier,logbufs=8 0 0
> >>
> >> These steps mount the drive under the mount point specified.
> >>
> >> If I remove the drive and insert it back in after a while, the drive
> >> doesn't mount, even though I have the required entry in fstab.
> >
> > Clarify, please: you *did* umount it before removing, correct?
> >>
> >> `mount -a` doesn't seem to work and provides me the following output,
> >>
> >> mount: wrong fs type, bad option, bad superblock on /dev/sdj,
> >>        missing codepage or helper program, or other error
> >>        In some cases useful info is found in syslog - try
> >>        dmesg | tail  or so
> >>
> > <snip>
> > Was there anything significant in dmesg?
> >
>       Also, did the drive change from sdf to sdj due to being
> removed/reinserted? What does parted or fdisk show about said drive?
>
> >       mark
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> >
> https://urldefense.proofpoint.com/v1/url?u=http://lists.centos.org/mailman/listinfo/centos&k=2a4Akkj3oY%2FOkjwft1MTMw%3D%3D%0A&r=tMZHZRUDG2%2BTRwBxuWe2n5rPULoPCwzzTu%2BUi79RuVM%3D%0A&m=DLqkQx0M%2F4Re4GtbvcZP7qiknKzjkbA8LiyaMbmPJgg%3D%0A&s=8b61b12b9ec8983c90ff543dfbf81ebcd4e77d914024308dd34e6648e22b87cd
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
>
> https://urldefense.proofpoint.com/v1/url?u=http://lists.centos.org/mailman/listinfo/centos&k=2a4Akkj3oY%2FOkjwft1MTMw%3D%3D%0A&r=tMZHZRUDG2%2BTRwBxuWe2n5rPULoPCwzzTu%2BUi79RuVM%3D%0A&m=DLqkQx0M%2F4Re4GtbvcZP7qiknKzjkbA8LiyaMbmPJgg%3D%0A&s=8b61b12b9ec8983c90ff543dfbf81ebcd4e77d914024308dd34e6648e22b87cd
>