System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Formating & mounting USB disk

Oscar Garcia
Regular Advisor

Formating & mounting USB disk

Hi Guys,

I had a WesternDigital disk mounted as vfat in a SLES 10, but as I was using it to backup files, I had the inconvenient of all the files being saved as root.
Somewhere I found that if I formatted the disk as NTFS I would be able to assign permissions.
Well I formatted in an XP box, but now I can not mount it:
# mount /dev/sda /opt/backup
mount: /dev/sda: can't read superblock

More info:
# lsusb
Bus 005 Device 002: ID 03f0:1027 Hewlett-Packard
Bus 005 Device 003: ID 03f0:1327 Hewlett-Packard
Bus 005 Device 001: ID 0000:0000
Bus 006 Device 003: ID 1058:1003 Western Digital Technologies, Inc.
Bus 006 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000

# fdisk -l
Disk /dev/dm-0: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table
...
Disk /dev/dm-29: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-29 doesn't contain a valid partition table

I will appreciate any help or advise you can give me.

Regards,
5 REPLIES
Steven Schweda
Honored Contributor

Re: Formating & mounting USB disk

> [...] but as I was using it to backup
> files, I had the inconvenient of all the
> files being saved as root.

"backup files" _how_, exactly?

> Somewhere

Where?

> I found that if I formatted the disk as
> NTFS I would be able to assign permissions.

Do you really believe that a UNIX(-like) file
system can't deal with file ownership and
permissions?

> Well I formatted in an XP box, but now I
> can not mount it:
> [...]

Have you considered telling "mount" that this
device has a NTFS file system on it?

man mount

Better yet, put the disk back the way it was,
and then try to solve your original problem
in some reasonable way.
Steven Schweda
Honored Contributor

Re: Formating & mounting USB disk

> [...] vfat [...]

OOPS. I missed that part. Sorry. The
"man mount" advice still holds, however.
Oscar Garcia
Regular Advisor

Re: Formating & mounting USB disk

Thanks Steve for your contributions.

I figured out what was wrong ( I was using /dev/sda1 rather than the new /dev/sdb1) and now I can mount the device formatted as NTFS, I think I panicked with all those errors that fdisk -l threw.

The entry in the fstab is

/dev/sdb1 /opt/backup ntfs rw,umask=0000 0 0

The problem now is that I can not write anything to it. For example:
# >hello
-bash: hello: Permission denied

and these are the permissions of the directory:
# ls -la /opt/backup
total 5
drwxrwxrwx 1 root root 4096 Oct 11 21:25 .
drwxr-xr-x 18 root root 496 Feb 23 2010 ..
drwxrwxrwx 1 root root 0 Oct 11 21:25 System Volume Information
Oscar Garcia
Regular Advisor

Re: Formating & mounting USB disk

Finally I managed to get it working! all thanks to cfdisk and fdisk (GUI interface). With #cfdisk /dev/sdb
I changed the type to linux and then using the partitioner (I believe is fdisk behind the YAST interface) I changed the type again to ext2 and formatted.
I think it mounted automatically after that, so unmounted changed the entry in fstab replacing ntfs with ext2, and re-mounted.
I can write, changed ownership, etc.

So we'll see how the backup goes...
Steven Schweda
Honored Contributor

Re: Formating & mounting USB disk

> The entry in the fstab is [...]

What does "mount" say about it?