0

I have two hard drives on my PC, one of them /dev/sda is installed with Ubuntu, and the other one /dev/sdb will be used for storage only.

I will run Samba to share the space. I tried to format the /dev/sdb with no partition, and it seems working fine for my purpose. But I am also wondering if I should create at least one primary partition for the entire /dev/sdb and use /dev/sdb1.

Anyone knows if there is any performance/stability difference?

  • I tried to format the /dev/sdb with no partition .. so you just did like an fdisk without doing a mkfs and you've told your smb.conf to point to /dev/sdb as a share? And that's working? – txtechhelp Jul 10 '16 at 0:35
  • You need a partition that determines the file system, if it is unallocated space it can't be used. – Ramhound Jul 10 '16 at 0:38
  • 1
    Samba has nothing to do with this. You need to set up a filesystem before Samba can share it. – David Schwartz Jul 10 '16 at 0:38
  • I did fdisk to delete all the existing partitions, and then w(write to the table). No partitions was added. Thank I did mkfs.ext3 to format the hard drive. Then mount the drive, configure Samba, start Samba, I was able to use it(add and delete file from another PC). – Dino Tw Jul 10 '16 at 3:44
  • I am also thinking since normally we don't partition external USB hard drive before using it, I guess it's probably fine for my question. – Dino Tw Jul 10 '16 at 3:54
1

Technically you can create a filesystem on the disk device itself (e.g. /dev/sdb without a number), since it's only a block device. If you partition the disk the 'only' difference is, you will have multiple block devices and a place for their metadata. I wouldn't recommend creating a filesystem on the disk device though, because most tools expect filesystems to sit on a partition and if you create a filesystem on say /dev/sdb there is nothing holding metadata about the filesystem on the device, because there is no partition table which would normally have the filesystem type in it. This makes it next to impossible for tools to see the filesystem, which is kind of risky. Also: Will you remember what filesystem type you put on it after a year or two?

You don't have to partition (and format) external USB hard drives because they are often delivered already formatted.

1

Samba (or any other tool that works on files) shouldn't care if the shared directory belongs to filesystem on a partition, directly on a device, on a remote machine; or exists within regular file on disk or in memory; or even if it spans over multiple filesystems because of mountpoints somewhere within the directory.

(Note: in general some tools may be set to avoid descending to another filesystems, it is irrelevant to your question though.)

The rule is: if you are able to mount the filesystem with the right permissions then Samba should work with it. It is the OS job to worry how the things work under the hood, not Samba's.

any performance/stability difference?

In your case I expect no difference because having a filesystem directly on /dev/sdb is nothing fancy. In fact this will bypass one level of abstraction so in theory you may even improve performance, yet I guess this gain will be negligible.

The disadvantages I can think of right now are:

  • Future problems with entities that expect to have a partition table on the device. Samba definitely is not one of these entities. You and other admins (if any) are. In two years your partitionless setup may cause "WTF?" in somebody's head.

  • Future troubles in case you need to do the thing for which we have partitions in a first place: logically splitting one block device to several. When you decide you need two partitions, it will be fairly easy to shrink the existing one and make room for the other... if there is the existing one! Partitionless setup will require more work, more knowledge and insight, and will give you more occasions to mess it up.

Now imagine the two above combined. With this image in mind I advise you to go with /dev/sdb1 because it is the least surprising thing.

  • Thank you for your input. I have set it up with no partition since the time I posted my question here, it's working great so far. This is my personal backup machine, I will be the only user. So I don't have to worry about the WTF. – Dino Tw Aug 30 '16 at 17:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.