Portál AbcLinuxu, 12. května 2025 11:09
Ahoj,
mozno trivialna otazka, ale fakt neviem, kde je problem ...
Potrebujem otestovat istu myslienku ohladom diskov v RAIDe a aby som sa nemusel babrat s fyzickymi diskami, tak to chcem najprv simulovat na pomocnych suboroch.
Na zaciatok mam vytvoreny 100 MB subor a chcel by som nastavit parametre a vytvorit tabulku particii. Avsak nejako mi tato "inicializacia" nechce fungovat
[m@localhost ~]$
# vytvorenie 100 MB suboru
[m@localhost ~]$ dd if=/dev/zero of=disk.image bs=10240 count=10240
10240+0 records in
10240+0 records out
104857600 bytes (105 MB) copied, 1.03732 s, 101 MB/s
[m@localhost ~]$
[m@localhost ~]$
[m@localhost ~]$ su -
Password:
[root@localhost ~]#
# fdiskovanie
[root@localhost ~]# fdisk /home/m/disk.image
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xef7883b7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
You must set cylinders.
You can do this from the extra functions menu.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): x
# nastavenie fyzickych parametrov (predpokladam, ze mozu byt lubovolne)
Expert command (m for help): c
# parametre su nastavene
Number of cylinders (1-1048576): 800
Expert command (m for help): h
Number of heads (1-256, default 255): 16
Expert command (m for help): s
Number of sectors (1-63, default 63): 16
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): r
Command (m for help): p
Disk /home/m/disk.image: 0 MB, 0 bytes
16 heads, 16 sectors/track, 800 cylinders
Units = cylinders of 256 * 512 = 131072 bytes
Disk identifier: 0xef7883b7
Device Boot Start End Blocks Id System
# vytvorenie part table
Command (m for help): o
Building a new DOS disklabel with disk identifier 0x85a8d3dd.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /home/m/disk.image: 0 MB, 0 bytes
16 heads, 16 sectors/track, 800 cylinders
Units = cylinders of 256 * 512 = 131072 bytes
Disk identifier: 0x85a8d3dd
Device Boot Start End Blocks Id System
# zapis zmien a exit
Command (m for help): w
The partition table has been altered!
Syncing disks.
# kontrola
[root@localhost ~]# fdisk -l /home/m/disk.image
You must set cylinders.
You can do this from the extra functions menu.
Disk /home/m/disk.image: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x85a8d3dd
Device Boot Start End Blocks Id System
[root@localhost ~]#
Podla tohto sa zmeny nezapisali, resp. este nieco tomu chyba. Nejaka idea, pls ?
Nechapu, ale zapsani partice vyhod:
error 25 inapropriate ioctl()P
Pouzit loop file?
NN
sice neviem poradit, ale nezda sa mi na tento riadok :
Disk /home/m/disk.image: 0 MB, 0 bytes
ako keby fdisk videl subor s nulovou velkostou, skus zistit preco.
Fdisk nevytvoří nic , protože nemůže nic vytvořit , prostě nemá kde , myslím, že jsou špatné parametry fdisku pro nastavení , aby mohl někam zapsat... Když budete něco vytvářet na souborech jako raid , myslím, že to nebude fungovat , jak chcete docílit toho , aby raid viděl partici na souboru ? mdadm se musí někde od něčeho odpíchnout a vědět co kam má připojovat. Jaksi nechápu pointu proč takto testovat raid.
Také mi trochu není jasné, proč nevytvořit pro každou partici vlastní soubor, když už chceš raid testovat přes loopback. Ale třeba to nějak jde, google pár linků na lkml vyhodí.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.