Skip to contentSkip to conversation

how to properly mount an external usb hard drive & other questions

DISCUSSION dhan.war 3 participants 5 messages Jan 5, 2014 Btrfs file system

lore
Share & tools
lore

dhan.war

author
#0 lore raw

hi all

i am using up to date debian sid with xfce desktop environment. i am using Linux 3.13-rc6-amd64 #1 SMP Debian 3.13~rc6-1~exp1 (2013-12-30) x86_64 GNU/Linux from experimental. i have installed usbmount to auto mount all the devices connected through USB.

[cmd# 1] i have created btrfs partition on my external USB hard drive using the following command :

# mkfs.btrfs -f -L btrfs -m single /dev/sdc
Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
fs created label btrfs on /dev/sdc
	nodesize 16384 leafsize 16384 sectorsize 4096 size 931.51GiB
Btrfs v3.12

[cmd# 2] my permissions of the device :

# ls -l /dev/sdc
brw-rw---- 1 root floppy 8, 32 Jan  5 09:47 /dev/sdc

my questions :
[a] does the partition created by me is appropriate ?
[b] how do i specify lzo compression in fstab ? last time when i tried to create entry fstab it is complaining about the auto mounting of the device by automount.
[c] what compression method is used by btrfs by default for the partitions created using the command mentioned above. [ cmd# 1]
[d] does the file permissions for my device are accurate ? [ cmd# 2]
[e] what is the appropriate fstab entry for my device ? [ i don't want to remove usbmount].
[f] should i use single or dup for the device ?

please provide suggestions for configuring my device appropriately. thank you for reading the message patiently.

please alway cc me.

regards,
wardhan.

#2 lore raw
In reply to Justus Seifert
Quoted 10 lines · Justus Seifert
Quoted 9 lines · dhan.war

hi all

i am using up to date debian sid with xfce desktop environment. i am using Linux 3.13-rc6-amd64 #1 SMP Debian 3.13~rc6-1~exp1 (2013-12-30) x86_64 GNU/Linux from experimental.
i have installed usbmount to auto mount all the devices connected through USB.
[…]

Quoted 5 lines
Quoted 2 lines

[e] what is the appropriate fstab entry for my device ? [ i don't want to remove usbmount].

/dev/sdc /path/to/your/favorite/mountpoint/that/has/to/exist/already btrfs compress,noauto 0 0

oh i forgot: if you want to mount it without su privileges you have to use:
/dev/sdc /path/to/your/favorite/mountpoint compress,noauto,users,user 0 0

also look into subvolume mounting with "subvol=myfirstsubvolume" in your list of mount options, if you want to do cool stuff with subvolumes.

begin:vcard
fn:Justus Seifert
n:Seifert;Justus
adr:;;;Dresden;Saxony;;Germany
email;internet:[email protected]
tel;cell:+4915730640509
x-mozilla-html:FALSE
version:2.1
end:vcard

#1 lore raw
In reply to dhan.war
Quoted 18 lines · dhan.war

hi all

i am using up to date debian sid with xfce desktop environment. i am using Linux 3.13-rc6-amd64 #1 SMP Debian 3.13~rc6-1~exp1 (2013-12-30) x86_64 GNU/Linux from experimental.
i have installed usbmount to auto mount all the devices connected through USB.

[cmd# 1] i have created btrfs partition on my external USB hard drive using the following command :

# mkfs.btrfs -f -L btrfs -m single /dev/sdc
Turning ON incompat feature 'extref': increased hardlink limit per file
to 65536
fs created label btrfs on /dev/sdc
    nodesize 16384 leafsize 16384 sectorsize 4096 size 931.51GiB
Btrfs v3.12
Quoted 6 lines

[cmd# 2] my permissions of the device :

# ls -l /dev/sdc
brw-rw---- 1 root floppy 8, 32 Jan  5 09:47 /dev/sdc

my questions :
[a] does the partition created by me is appropriate ?

it seems ok

Quoted 3 lines

[b] how do i specify lzo compression in fstab ? last time when i tried to create entry fstab it is complaining about the auto mounting of the device by automount.

if you dont want the partition to be mounted with the fstab during boot then you should add "noauto" to the list of options in the respective fstab line.

Quoted 2 lines

[c] what compression method is used by btrfs by default for the partitions created using the command mentioned above. [ cmd# 1]

none. if you order mount to use compression without spezifieng the algo, it will use zlib (thats like gz). if you do not use the option "compression" then it will not compress new files.

Quoted 1 line

[d] does the file permissions for my device are accurate ? [ cmd# 2]

i dont know. are you member of the group floppy? what is the purpose of the group floppy on your machine? what users are members of the group floppy?

Quoted 2 lines

[e] what is the appropriate fstab entry for my device ? [ i don't want to remove usbmount].

/dev/sdc /path/to/your/favorite/mountpoint/that/has/to/exist/already btrfs compress,noauto 0 0

Quoted 1 line

[f] should i use single or dup for the device ?

maybe use single

Quoted 8 lines

please provide suggestions for configuring my device appropriately. thank you for reading the message patiently.

please alway cc me.

regards,
wardhan.

i tried to keep it short. feel free to ask for more.

cheers
justus

begin:vcard
fn:Justus Seifert
n:Seifert;Justus
adr:;;;Dresden;Saxony;;Germany
email;internet:[email protected]
tel;cell:+4915730640509
x-mozilla-html:FALSE
version:2.1
end:vcard

#3 lore raw
In reply to Justus Seifert
Quoted 3 lines · Justus Seifert

oh i forgot: if you want to mount it without su privileges you have to use:

/dev/sdc /path/to/your/favorite/mountpoint compress,noauto,users,user 0 0

If you want LZO compression, as you specified:

/dev/sdc /path/to/mountpoint compress=lzo,noauto,users,user 0 0

Better yet, if your btrfs is actually on /dev/sdc right now, let's get that fstab entry mounting it by UUID instead.

ls -l /dev/disk/by-uuid | grep sdc lrwxrwxrwx 1 root root 10 Jan 3 09:40
12345678-9abc0-1234-5678-9a0123456789 -> ../../sdc

So then:

          # this is not a real UUID, you need to check 
/dev/disk/by-uuid on your machine for a real UUID
          UUID=12345678-9abc0-1234-5678-9a0123456789 
/path/to/mountpoint   compress=lzo,noauto,users,user   0   0

This is EXTRA important with a USB drive, since it's HIGHLY likely it won't always be on the same physical devicename.

#4 lore raw
Quoted 10 lines · Jim Salter

If you want LZO compression, as you specified:

/dev/sdc /path/to/mountpoint compress=lzo,noauto,users,user 0 0

Better yet, if your btrfs is actually on /dev/sdc right now, let's get that fstab entry mounting it by UUID instead.

ls -l /dev/disk/by-uuid | grep sdc lrwxrwxrwx 1 root root 10 Jan 3 09:40
12345678-9abc0-1234-5678-9a0123456789 -> ../../sdc

Quoted 8 lines

So then:

          # this is not a real UUID, you need to check 
/dev/disk/by-uuid on your machine for a real UUID
          UUID=12345678-9abc0-1234-5678-9a0123456789 
/path/to/mountpoint   compress=lzo,noauto,users,user   0   0

This is EXTRA important with a USB drive, since it's HIGHLY likely it won't always be on the same physical devicename.

One other note: in this particular case, you might actually be better served setting compression by mounting the drive normally, then:

cd /path/to/drive
chattr +c . ; chattr +c * ; chattr +c .*

This will set compression on by default for any future files stored on that USB drive, *without* needing any special mount options.

Why might this be a better idea? Well, if it's a USB drive, presumably you might want to mount it on foreign systems from time to time. This way, even if you mount the drive on a foreign system that doesn't know anything about your preferences, it will see the +c on the root directory of the drive, and store any new data on the drive compressed.

The only caveat: +c won't set the compression algorithm to LZO. It'll be gzip, which is the default algorithm. (And, of course, this won't compress any EXISTING data already stored there - only NEW data written to it after you set the +c attribute.)