cc_staff
7
edits
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
<!--T:5--> | <!--T:5--> | ||
It is possible to get the value of those parameters for a given file or directory using the command | It is possible to get the value of those parameters for a given file or directory using the command | ||
{{Command|lfs getstripe | {{Command|lfs getstripe /path/to/file}} | ||
<!--T:6--> | <!--T:6--> | ||
It is also possible to change those parameters for a given directory using the command | It is also possible to change those parameters for a given directory using the command | ||
{{Command|lfs setstripe -c | {{Command|lfs setstripe -c count /path/to/dir}} | ||
<!--T:7--> | <!--T:7--> | ||
For example, if ''count''=8 | For example, if ''count''=8 , then the files will be spread on 8 targets (RAIDs), each MB will be written in a round-robin fashion on up to 8 different servers. | ||
{{Command|lfs setstripe -c 8 /home/user/newdir}} | |||
<!--T:8--> | <!--T:8--> | ||
Changing the stripe count will not modify a existing file. To change those parameters, the file must be '''copied''' (not moved) to a directory with different parameters or the file need to be migrated. To create an empty file with a given value of those parameters without changing the parameters of the directory, you may run ''lfs setstripe'' on the name of the file to be created. The file will be created as an empty file with the given parameters. | |||
Example of a non-stripped directory with a file called "example_file" (lmm_stripe_count is 1 and there is only 1 object for the file) | |||
$ lfs getstripe striping_example/ | |||
striping_example/ | |||
stripe_count: 1 stripe_size: 1048576 pattern: raid0 stripe_offset: -1 | |||
striping_example//example_file | |||
lmm_stripe_count: 1 | |||
lmm_stripe_size: 1048576 | |||
lmm_pattern: raid0 | |||
lmm_layout_gen: 0 | |||
lmm_stripe_offset: 2 | |||
obdidx objid objid group | |||
2 3714477 0x38adad 0x300000400 | |||
We can change the stripping of this directory to use a stripe count of 2 and create a new file. | |||
$ lfs setstripe -c 2 striping_example | |||
$ dd if=/dev/urandom of=striping_example/new_file bs=1M count=10 | |||
$ lfs getstripe striping_example/ | |||
striping_example/ | |||
stripe_count: 2 stripe_size: 1048576 pattern: raid0 stripe_offset: -1 | |||
striping_example//example_file | |||
lmm_stripe_count: 1 | |||
lmm_stripe_size: 1048576 | |||
lmm_pattern: raid0 | |||
lmm_layout_gen: 0 | |||
lmm_stripe_offset: 2 | |||
obdidx objid objid group | |||
2 3714477 0x38adad 0x300000400 | |||
striping_example//new_file | |||
lmm_stripe_count: 2 | |||
lmm_stripe_size: 1048576 | |||
lmm_pattern: raid0 | |||
lmm_layout_gen: 0 | |||
lmm_stripe_offset: 3 | |||
obdidx objid objid group | |||
3 3714601 0x38ae29 0x400000400 | |||
0 3714618 0x38ae3a 0x2c0000400 | |||
Only the new_file is using the new default of count=2 (lmm_stripe_count) and 2 objects are allocated. | |||
We can restripe the old file using ''lfs migrate'' | |||
$ lfs migrate -c 2 striping_example/example_file | |||
$ lfs getstripe striping_example/example_file | |||
striping_example/example_file | |||
lmm_stripe_count: 2 | |||
lmm_stripe_size: 1048576 | |||
lmm_pattern: raid0 | |||
lmm_layout_gen: 2 | |||
lmm_stripe_offset: 10 | |||
obdidx objid objid group | |||
10 3685344 0x383be0 0x500000400 | |||
11 3685328 0x383bd0 0x540000400 | |||
The file now has a lmm_stripe_count of 2 and 2 objects are allocated | |||
<!--T:9--> | <!--T:9--> |