|
General Hardware General hardware related questions. |
|
Thread Tools | Display Modes |
|
|||
Should my USB disk work on BSD?
I have bought a nice little disk to store my backups that require a lot of diskspace (smaller stuff I backup with tarsnap).
It is a Seagate 4 TB Backup Plus Portable, and I bought it here. I have not yet unsealed the package, because I noticed the text "Use between Windows and Mac". This seemed unlikely to me. Just to be sure, I called Alternate to ask if I can repartion it, put any filesystem on it and just use it on OpenBSD or GNU/Linux. They told me that only Windows and Mac is supported, and they said it was very unlikely it would work on anything else. I still find it unlikely, but just to be sure: do you have any experience with drives like this that actually give problems on the better operating systems? |
|
||||
This is a mass storage device using USB for its connection. It *must* follow standards, which are OS agnostic. The vendor may not have ever heard of anything but "Windows" and "Mac" but that should not preclude the product's adherence to standards and therefore its use.
See: https://en.wikipedia.org/wiki/USB_ma...e_device_class and https://en.wikipedia.org/wiki/USB_Attached_SCSI for information on the technical standards the disk should adhere to. I don't know what the 24-month warranty includes, nor what can be implied under the regulations of your country. I don't know EU law, but under directive 1999/44/EC the customer's country's laws and regulations -- if EU -- apply to the transaction, as the seller was in the EU. As for OpenBSD -- if the drive connects to it -- you can provision an MBR or a GPT. If the sector size is 512 bytes, an MBR will only address 2TB, though the disklabel could still address the entire drive. An MBR or GPT would be protective in nature, as those are recognized by other OSes. Last edited by jggimi; 26th January 2017 at 06:55 PM. Reason: one typo, and one thinko, and some additional clarity |
|
|||
Good to know that I should not expect any problems at the hardware side!
Concerning the partitioning, if I have an MBR and then create an OpenBSD partition in it, I understand that I can only assign 2 TB to it. But then I create a disklabel on it and I can assign the whole 4 TB?! I don't think that I understand it. Also, GPT is new for me: I understand it is like MBR but it can do more (no limitations like 4 primary partitions, or 2 TB). Is that right? Then the filesystems, what should I use if I want to read it under both OpenBSD and Linux? At least the first 2 TB? Something like this maybe: * 1 GPT partition of 1.5 TB with a VFAT filesystem; * 1 GPT disklabel partition of 2.5 TB with an FFS partition. Then the first one can be fully used by any operating system. The second could maybe only easily be used in BSDs. The VFAT may fragment, and has neither journaling nor softdeps which may be suboptimal for data integrity. But if I take ext3, I only have journaling in Linux but not in OpenBSD where it is used as ext2. Last edited by hulten; 26th January 2017 at 09:54 PM. |
|
||||
I just tried this in a virtual machine. Here is a 4TB (virtual) drive. The disklabel program shows all sectors of the drive:
Code:
# disklabel sd1 # /dev/rsd1c: type: SCSI disk: SCSI disk label: Block Device duid: 0000000000000000 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 534698 total sectors: 8589934592 boundstart: 0 boundend: 8589934592 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] c: 8589934592 0 unused Code:
# fdisk sd1 Disk: sd1 geometry: 267349/255/63 [4294961685 Sectors] Offset: 0 Signature: 0x0 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused Code:
# fdisk -igy sd1 Writing MBR at offset 0. Writing GPT. Code:
# fdisk sd1 Disk: sd1 Usable LBA: 64 to 8589934528 [8589934592 Sectors] #: type [ start: size ] ------------------------------------------------------------------------ 3: OpenBSD [ 64: 8589934465 ] Code:
# fdisk -e sd1 Enter 'help' for information fdisk: 1> e 3 #: type [ start: size ] ------------------------------------------------------------------------ 3: OpenBSD [ 64: 8589934465 ] Partition id ('0' to disable) [01 - FF]: [A6] (? for help) 0 Partition 3 is disabled. Code:
fdisk:*1> e 0 #: type [ start: size ] ------------------------------------------------------------------------ 0: unused [ 0: 1 ] Partition id ('0' to disable) [01 - FF]: [0] (? for help) 0C Partition offset [64 - 8589934528]: [64] Partition size [1 - 8589934465]: [8589934465] 1500g Partition name: [] fat32 Code:
fdisk:*1> p Disk: sd1 Usable LBA: 64 to 8589934528 [8589934592 Sectors] GUID: 797fb8e9-dc04-4f2b-9eb5-0c9c100925ab #: type [ start: size ] guid name ------------------------------------------------------------------------ 0: DOS FAT-12 [ 64: 3145728000 ] ae179056-a87a-47d6-86de-813f5b9ffcb4 fat32 Code:
fdisk:*1> e 1 #: type [ start: size ] ------------------------------------------------------------------------ 1: unused [ 0: 1 ] Partition id ('0' to disable) [01 - FF]: [0] (? for help) a6 Partition offset [64 - 8589934528]: [64] 3145728064 Partition size [1 - 5444206465]: [5444206465] * Partition name: [] OpenBSD Code:
fdisk:*1> p g Disk: sd1 Usable LBA: 64 to 8589934528 [4096 Gigabytes] GUID: 797fb8e9-dc04-4f2b-9eb5-0c9c100925ab #: type [ start: size ] guid name ------------------------------------------------------------------------ 0: DOS FAT-12 [ 64: 1500G] ae179056-a87a-47d6-86de-813f5b9ffcb4 fat32 1: OpenBSD [ 3145728064: 2596G] 59b48cf6-3b3f-4ea7-a167-0e1f171aa944 OpenBSD fdisk:*1> w Writing MBR at offset 0. Writing GPT. fdisk: 1> q # Code:
# disklabel sd1 # /dev/rsd1c: type: SCSI disk: SCSI disk label: Block Device duid: 0000000000000000 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 534698 total sectors: 8589934592 boundstart: 3145728064 boundend: 8589934529 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] c: 8589934592 0 unused i: 3145728000 64 MSDOS Code:
# disklabel -E sd1 Label editor (enter '?' for help at any prompt) > a d offset: [3145728064] size: [5444206465] FS type: [4.2BSD] Rounding size to bsize (128 sectors): 5444206400 > w > q No label changes. # Code:
# disklabel -p g sd1 # /dev/rsd1c: type: SCSI disk: SCSI disk label: Block Device duid: d2f93a7a514914bd flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 534698 total sectors: 8589934592 # total bytes: 4096.0G boundstart: 3145728064 boundend: 8589934529 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] c: 4096.0G 0 unused d: 2596.0G 3145728064 4.2BSD 8192 65536 1 i: 1500.0G 64 MSDOS # Last edited by jggimi; 27th January 2017 at 02:13 AM. Reason: a little clarity, lots of little typos, plus one glaring one |
|
|||
@jggimi, thank you for the clear explanation and howto. I just partioned the drive and now formatting the fat32 partition with
Code:
newfs_msdos sd0i usbdevs(8) tells me it is an EHCI device, so that's USB 2. I have an extension USB cable between the computer and the official USB cord delivered with the disk; could that make it revert to even lower speeds? |
|
||||
Indeed, it takes a very long time.
Quote:
A mass storage device presents either 512-byte or 4096-byte blocks to the systems. On a write operation, the OS sends either 512 bytes or 4096 bytes to be written, along with the sector number to write to. Every filesystem contains a structure for storing and managing data. You know the ones presented to users, such as Files, and file names. Directories, or folders. You also know about access controls, and status flags such as "read only" or "hidden." But filesystems also contain data that is not presented directly to users, such as lists of free space, and structures to manage lists of used space. All of those structures must be initiated as data stored on the drive before the file system can be established and used. It is this process which we call "formatting." Quote:
|
|
|||
Formatting was much faster (less than a minute) for the ffs compared with fat32 (more than an hour). This is surprising because you mentioned that every filesystem needs this extra stuff like lists of free space which would take time to put on the disk.
The result Code:
# disklabel sd0 # /dev/rsd0c: ... 16 partitions: # size offset fstype [fsize bsize cpg] c: 7814037167 0 unused d: 4668308928 3145728064 4.2BSD 8192 65536 1 i: 3145728000 64 MSDOS # mount ... /dev/sd0d on /mnt/sd0d type ffs (local) /dev/sd0i on /mnt/sd0i type msdos (local) # df -h /mnt/* Filesystem Size Used Avail Capacity Mounted on /dev/sd0d 2.2T 8.0K 2.0T 0% /mnt/sd0d /dev/sd0i 1.5T 8.0K 1.5T 0% /mnt/sd0i Of course the total does not add to 4 TiB but rather something like 4 TB, because hard disk vendors use base 10 (or, alternatively, they are bastards). As mount(8) does not show it is FFS2 and the next thing I saw was that I have "2.0T" available on the FFS filesystem, I thought it was FFS, but I guess it is FFS2. |
|
||||
FAT and FFS are very different filesystems. FFS needs a superblock, backup superblocks, cylinder group maps with inode structures. FAT requires much more, such as the File Allocation Tables and the Cluster Map.
FFS While there are many differences between UFS/FFS implementations, this wiki page should help to understand the general structure of FFS/FFS2 on OpenBSD. FAT While this is not the only documentation availalble, here is a key wiki page that may help you to understand the structure of a FAT filesystem. Last edited by jggimi; 2nd February 2017 at 06:44 PM. Reason: there is only one superblock. All the others are merely backups. :) |
|
||||
5% is the standard reserved free space for FFS/FFS2 on OpenBSD. If you are unaware, this can produce confusing reports from df(1), such as showing a drive at greater than 100% capacity.
There's a FAQ entry about it here. Last edited by jggimi; 2nd February 2017 at 06:03 PM. Reason: clarity |
Tags |
hard disk, storage, support |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
disk mgt and zfs | ananix | FreeBSD General | 1 | 26th December 2011 10:37 PM |
Hard disk won't work after changing case | sepuku | OpenBSD General | 68 | 8th September 2011 03:09 PM |
Disk > 100% | Weaseal | FreeBSD General | 3 | 11th February 2009 05:50 PM |
Disk geometry for Seagate disk | phreud | FreeBSD Installation and Upgrading | 5 | 8th November 2008 10:51 PM |
Disk I/O Throughput | m4rc | OpenBSD General | 5 | 10th July 2008 02:50 AM |